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 1d643dabe5)
This commit is contained in:
Jeff Hao
2017-03-28 15:24:14 -07:00
parent adc1605530
commit b0be09922c

View File

@@ -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) {