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

Commit b0be0992 authored by Jeff Hao's avatar Jeff Hao
Browse files

Fix PackageManagerService passing usesLibraryFiles to dexOpt.

The shared libraries for the package need to be updated before calling
performDexOpt so that they can be populated and passed down to dexOpt.
This isn't missing in the AOSP version, so the fix is only for master.

Bug: 36698836
Test: cts-tradefed run singleCommand cts -d --module
CtsAppSecurityHostTestCases -t
android.appsecurity.cts.UsesLibraryHostTest

Change-Id: Id58bd50a13e5115af03c9167d4eb7f4b1d1dc9da
(cherry picked from commit 1d643dab)
parent adc16055
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -16965,6 +16965,15 @@ public class PackageManagerService extends IPackageManager.Stub {
                return;
            }
            // Shared libraries for the package need to be updated.
            synchronized (mPackages) {
                try {
                    updateSharedLibrariesLPr(pkg, null);
                } catch (PackageManagerException e) {
                    Slog.e(TAG, "updateAllSharedLibrariesLPw failed: " + e.getMessage());
                }
            }
            Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt");
            // Do not run PackageDexOptimizer through the local performDexOpt
            // method because `pkg` may not be in `mPackages` yet.
@@ -17013,6 +17022,7 @@ public class PackageManagerService extends IPackageManager.Stub {
                        args.user, installerPackageName, volumeUuid, res, args.installReason);
            }
        }
        synchronized (mPackages) {
            final PackageSetting ps = mSettings.mPackages.get(pkgName);
            if (ps != null) {