use of android.content.pm.PackageInfo in project android_frameworks_base by ResurrectionRemix.
the class BackupManagerService method dumpAgents.
private void dumpAgents(PrintWriter pw) {
List<PackageInfo> agentPackages = allAgentPackages();
pw.println("Defined backup agents:");
for (PackageInfo pkg : agentPackages) {
pw.print(" ");
pw.print(pkg.packageName);
pw.println(':');
pw.print(" ");
pw.println(pkg.applicationInfo.backupAgentName);
}
}
use of android.content.pm.PackageInfo in project android_frameworks_base by ResurrectionRemix.
the class PackageManagerBackupAgent method writeStateFile.
// Util: write out our new backup state file
private void writeStateFile(List<PackageInfo> pkgs, ComponentName preferredHome, long homeVersion, ArrayList<byte[]> homeSigHashes, ParcelFileDescriptor stateFile) {
FileOutputStream outstream = new FileOutputStream(stateFile.getFileDescriptor());
BufferedOutputStream outbuf = new BufferedOutputStream(outstream);
DataOutputStream out = new DataOutputStream(outbuf);
// by the time we get here we know we've done all our backing up
try {
// state file version header
out.writeUTF(STATE_FILE_HEADER);
out.writeInt(STATE_FILE_VERSION);
// If we remembered a preferred home app, record that
if (preferredHome != null) {
out.writeUTF(DEFAULT_HOME_KEY);
out.writeUTF(preferredHome.flattenToString());
out.writeLong(homeVersion);
writeSignatureHashArray(out, homeSigHashes);
}
// Conclude with the metadata block
out.writeUTF(GLOBAL_METADATA_KEY);
out.writeInt(Build.VERSION.SDK_INT);
out.writeUTF(Build.VERSION.INCREMENTAL);
// now write all the app names + versions
for (PackageInfo pkg : pkgs) {
out.writeUTF(pkg.packageName);
out.writeInt(pkg.versionCode);
}
out.flush();
} catch (IOException e) {
Slog.e(TAG, "Unable to write package manager state file!");
}
}
use of android.content.pm.PackageInfo in project android_frameworks_base by ResurrectionRemix.
the class OverlayManagerServiceImpl method onTargetPackageUpgraded.
void onTargetPackageUpgraded(@NonNull final String packageName, final int userId) {
if (DEBUG) {
Slog.d(TAG, "onTargetPackageUpgraded packageName=" + packageName + " userId=" + userId);
}
final PackageInfo targetPackage = mPackageManager.getPackageInfo(packageName, userId);
updateAllOverlaysForTarget(packageName, userId, targetPackage);
}
use of android.content.pm.PackageInfo in project android_frameworks_base by ResurrectionRemix.
the class OverlayManagerServiceImpl method updateAllOverlaysForTarget.
private void updateAllOverlaysForTarget(@NonNull final String packageName, final int userId, @Nullable final PackageInfo targetPackage) {
final List<OverlayInfo> ois = mSettings.getOverlaysForTarget(packageName, userId);
for (final OverlayInfo oi : ois) {
final PackageInfo overlayPackage = mPackageManager.getPackageInfo(oi.packageName, userId);
if (overlayPackage == null) {
mSettings.remove(oi.packageName, oi.userId);
removeIdmapIfPossible(oi);
} else {
try {
updateState(targetPackage, overlayPackage, userId);
} catch (OverlayManagerSettings.BadKeyException e) {
Slog.e(TAG, "failed to update settings", e);
mSettings.remove(oi.packageName, userId);
}
}
}
}
use of android.content.pm.PackageInfo in project android_frameworks_base by ResurrectionRemix.
the class OverlayManagerServiceImpl method onTargetPackageChanged.
void onTargetPackageChanged(@NonNull final String packageName, final int userId) {
if (DEBUG) {
Slog.d(TAG, "onTargetPackageChanged packageName=" + packageName + " userId=" + userId);
}
final PackageInfo targetPackage = mPackageManager.getPackageInfo(packageName, userId);
updateAllOverlaysForTarget(packageName, userId, targetPackage);
}
Aggregations