OtaDexopt: Special-case system app classpaths

Specialize system apps' shared libraries so that classpath checks
are elided.

Bug: 30568568
Change-Id: Id1f2555ef43984b616e01f8596701ccba77895b3
This commit is contained in:
Andreas Gampe
2016-08-01 22:08:26 -07:00
parent fc9689e1ed
commit c7e02c1d2a

View File

@@ -50,6 +50,9 @@ public class OtaDexoptService extends IOtaDexopt.Stub {
private final static String TAG = "OTADexopt";
private final static boolean DEBUG_DEXOPT = true;
// The synthetic library dependencies denoting "no checks."
private final static String[] NO_LIBRARIES = new String[] { "&" };
private final Context mContext;
private final PackageManagerService mPackageManagerService;
@@ -202,7 +205,13 @@ public class OtaDexoptService extends IOtaDexopt.Stub {
PackageDexOptimizer optimizer = new OTADexoptPackageDexOptimizer(
collectingInstaller, mPackageManagerService.mInstallLock, mContext);
optimizer.performDexOpt(pkg, pkg.usesLibraryFiles,
String[] libraryDependencies = pkg.usesLibraryFiles;
if (pkg.isSystemApp()) {
// For system apps, we want to avoid classpaths checks.
libraryDependencies = NO_LIBRARIES;
}
optimizer.performDexOpt(pkg, libraryDependencies,
null /* ISAs */, false /* checkProfiles */,
getCompilerFilterForReason(compilationReason),
null /* CompilerStats.PackageStats */);