Merge "Block the upgrade of persistent apps" am: 0b30d95dc8

am: 6de91158d7

Change-Id: I729df40376b972461908d22593b63f4f5399e356
This commit is contained in:
Todd Kennedy
2017-12-12 15:14:20 +00:00
committed by android-build-merger

View File

@@ -18608,6 +18608,13 @@ public class PackageManagerService extends IPackageManager.Stub
+ " target SDK " + oldTargetSdk + " does."); + " target SDK " + oldTargetSdk + " does.");
return; return;
} }
// Prevent persistent apps from being updated
if ((oldPackage.applicationInfo.flags & ApplicationInfo.FLAG_PERSISTENT) != 0) {
res.setError(PackageManager.INSTALL_FAILED_INVALID_APK,
"Package " + oldPackage.packageName + " is a persistent app. "
+ "Persistent apps are not updateable.");
return;
}
// Prevent apps from downgrading their targetSandbox. // Prevent apps from downgrading their targetSandbox.
final int oldTargetSandbox = oldPackage.applicationInfo.targetSandboxVersion; final int oldTargetSandbox = oldPackage.applicationInfo.targetSandboxVersion;
final int newTargetSandbox = pkg.applicationInfo.targetSandboxVersion; final int newTargetSandbox = pkg.applicationInfo.targetSandboxVersion;