Merge "Don't allow update of a static shared library"

This commit is contained in:
Rhed Jao
2020-09-11 02:12:14 +00:00
committed by Android (Google) Code Review

View File

@@ -17737,12 +17737,10 @@ public class PackageManagerService extends IPackageManager.Stub
if (parsedPackage.isStaticSharedLibrary()) { if (parsedPackage.isStaticSharedLibrary()) {
// Static libs have a synthetic package name containing the version // Static libs have a synthetic package name containing the version
// and cannot be updated as an update would get a new package name, // and cannot be updated as an update would get a new package name,
// unless this is the exact same version code which is useful for // unless this is installed from adb which is useful for development.
// development.
AndroidPackage existingPkg = mPackages.get(parsedPackage.getPackageName()); AndroidPackage existingPkg = mPackages.get(parsedPackage.getPackageName());
if (existingPkg != null if (existingPkg != null
&& existingPkg.getLongVersionCode() && (installFlags & PackageManager.INSTALL_FROM_ADB) == 0) {
!= parsedPackage.getLongVersionCode()) {
throw new PrepareFailure(INSTALL_FAILED_DUPLICATE_PACKAGE, throw new PrepareFailure(INSTALL_FAILED_DUPLICATE_PACKAGE,
"Packages declaring " "Packages declaring "
+ "static-shared libs cannot be updated"); + "static-shared libs cannot be updated");