Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4709c788 authored by Rhed Jao's avatar Rhed Jao
Browse files

Don't allow update of a static shared library

Unless it's installed from adb which is necessary
to work for development purposes.

Bug: 140243304
Test: atest StaticSharedLibsHostTests
Change-Id: I8609797d563571b06344a4d1efc5903361e1bf41
parent b0e58545
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -17758,12 +17758,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");