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()) {
// 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");