Merge "Don't allow update of a static shared library" am: 7753f5eb83

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12525777

Change-Id: If328dffadbcddc7ba6bcac310bcde15e6928cab1
This commit is contained in:
Rhed Jao
2020-09-11 02:22:45 +00:00
committed by Automerger Merge Worker

View File

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