Loading core/java/com/android/internal/os/ZygoteInit.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -576,7 +576,8 @@ public class ZygoteInit { installd.dexopt(classPathElement, Process.SYSTEM_UID, packageName, installd.dexopt(classPathElement, Process.SYSTEM_UID, packageName, instructionSet, dexoptNeeded, outputPath, dexFlags, compilerFilter, instructionSet, dexoptNeeded, outputPath, dexFlags, compilerFilter, uuid, classLoaderContext, seInfo, false /* downgrade */, uuid, classLoaderContext, seInfo, false /* downgrade */, targetSdkVersion, /*profileName*/ null, /*dexMetadataPath*/ null); targetSdkVersion, /*profileName*/ null, /*dexMetadataPath*/ null, "server-dexopt"); } catch (RemoteException | ServiceSpecificException e) { } catch (RemoteException | ServiceSpecificException e) { // Ignore (but log), we need this on the classpath for fallback mode. // Ignore (but log), we need this on the classpath for fallback mode. Log.w(TAG, "Failed compiling classpath element for system server: " Log.w(TAG, "Failed compiling classpath element for system server: " Loading services/core/java/com/android/server/pm/Installer.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -286,14 +286,14 @@ public class Installer extends SystemService { int dexoptNeeded, @Nullable String outputPath, int dexFlags, int dexoptNeeded, @Nullable String outputPath, int dexFlags, String compilerFilter, @Nullable String volumeUuid, @Nullable String sharedLibraries, String compilerFilter, @Nullable String volumeUuid, @Nullable String sharedLibraries, @Nullable String seInfo, boolean downgrade, int targetSdkVersion, @Nullable String seInfo, boolean downgrade, int targetSdkVersion, @Nullable String profileName, @Nullable String dexMetadataPath) @Nullable String profileName, @Nullable String dexMetadataPath, throws InstallerException { @Nullable String compilationReason) throws InstallerException { assertValidInstructionSet(instructionSet); assertValidInstructionSet(instructionSet); if (!checkBeforeRemote()) return; if (!checkBeforeRemote()) return; try { try { mInstalld.dexopt(apkPath, uid, pkgName, instructionSet, dexoptNeeded, outputPath, mInstalld.dexopt(apkPath, uid, pkgName, instructionSet, dexoptNeeded, outputPath, dexFlags, compilerFilter, volumeUuid, sharedLibraries, seInfo, downgrade, dexFlags, compilerFilter, volumeUuid, sharedLibraries, seInfo, downgrade, targetSdkVersion, profileName, dexMetadataPath); targetSdkVersion, profileName, dexMetadataPath, compilationReason); } catch (Exception e) { } catch (Exception e) { throw InstallerException.from(e); throw InstallerException.from(e); } } Loading services/core/java/com/android/server/pm/OtaDexoptService.java +5 −3 Original line number Original line Diff line number Diff line Loading @@ -262,11 +262,12 @@ public class OtaDexoptService extends IOtaDexopt.Stub { int dexFlags, String compilerFilter, @Nullable String volumeUuid, int dexFlags, String compilerFilter, @Nullable String volumeUuid, @Nullable String sharedLibraries, @Nullable String seInfo, boolean downgrade, @Nullable String sharedLibraries, @Nullable String seInfo, boolean downgrade, int targetSdkVersion, @Nullable String profileName, int targetSdkVersion, @Nullable String profileName, @Nullable String dexMetadataPath) throws InstallerException { @Nullable String dexMetadataPath, @Nullable String dexoptCompilationReason) throws InstallerException { final StringBuilder builder = new StringBuilder(); final StringBuilder builder = new StringBuilder(); // The version. Right now it's 6. // The version. Right now it's 7. builder.append("6 "); builder.append("7 "); builder.append("dexopt"); builder.append("dexopt"); Loading @@ -285,6 +286,7 @@ public class OtaDexoptService extends IOtaDexopt.Stub { encodeParameter(builder, targetSdkVersion); encodeParameter(builder, targetSdkVersion); encodeParameter(builder, profileName); encodeParameter(builder, profileName); encodeParameter(builder, dexMetadataPath); encodeParameter(builder, dexMetadataPath); encodeParameter(builder, dexoptCompilationReason); commands.add(builder.toString()); commands.add(builder.toString()); } } Loading services/core/java/com/android/server/pm/PackageDexOptimizer.java +8 −7 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.util.Slog; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.GuardedBy; import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.IndentingPrintWriter; import com.android.server.pm.Installer.InstallerException; import com.android.server.pm.Installer.InstallerException; import com.android.server.pm.dex.DexManager; import com.android.server.pm.dex.DexoptOptions; import com.android.server.pm.dex.DexoptOptions; import com.android.server.pm.dex.DexoptUtils; import com.android.server.pm.dex.DexoptUtils; import com.android.server.pm.dex.PackageDexUsage; import com.android.server.pm.dex.PackageDexUsage; Loading Loading @@ -63,7 +62,8 @@ import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets; import static com.android.server.pm.PackageManagerService.WATCHDOG_TIMEOUT; import static com.android.server.pm.PackageManagerService.WATCHDOG_TIMEOUT; import static dalvik.system.DexFile.getNonProfileGuidedCompilerFilter; import static com.android.server.pm.PackageManagerServiceCompilerMapping.getReasonName; import static dalvik.system.DexFile.getSafeModeCompilerFilter; import static dalvik.system.DexFile.getSafeModeCompilerFilter; import static dalvik.system.DexFile.isProfileGuidedCompilerFilter; import static dalvik.system.DexFile.isProfileGuidedCompilerFilter; Loading Loading @@ -236,7 +236,8 @@ public class PackageDexOptimizer { for (String dexCodeIsa : dexCodeInstructionSets) { for (String dexCodeIsa : dexCodeInstructionSets) { int newResult = dexOptPath(pkg, path, dexCodeIsa, compilerFilter, int newResult = dexOptPath(pkg, path, dexCodeIsa, compilerFilter, profileUpdated, classLoaderContexts[i], dexoptFlags, sharedGid, profileUpdated, classLoaderContexts[i], dexoptFlags, sharedGid, packageStats, options.isDowngrade(), profileName, dexMetadataPath); packageStats, options.isDowngrade(), profileName, dexMetadataPath, options.getCompilationReason()); // The end result is: // The end result is: // - FAILED if any path failed, // - FAILED if any path failed, // - PERFORMED if at least one path needed compilation, // - PERFORMED if at least one path needed compilation, Loading @@ -261,7 +262,7 @@ public class PackageDexOptimizer { private int dexOptPath(PackageParser.Package pkg, String path, String isa, private int dexOptPath(PackageParser.Package pkg, String path, String isa, String compilerFilter, boolean profileUpdated, String classLoaderContext, String compilerFilter, boolean profileUpdated, String classLoaderContext, int dexoptFlags, int uid, CompilerStats.PackageStats packageStats, boolean downgrade, int dexoptFlags, int uid, CompilerStats.PackageStats packageStats, boolean downgrade, String profileName, String dexMetadataPath) { String profileName, String dexMetadataPath, int compilationReason) { int dexoptNeeded = getDexoptNeeded(path, isa, compilerFilter, classLoaderContext, int dexoptNeeded = getDexoptNeeded(path, isa, compilerFilter, classLoaderContext, profileUpdated, downgrade); profileUpdated, downgrade); if (Math.abs(dexoptNeeded) == DexFile.NO_DEXOPT_NEEDED) { if (Math.abs(dexoptNeeded) == DexFile.NO_DEXOPT_NEEDED) { Loading @@ -288,7 +289,7 @@ public class PackageDexOptimizer { mInstaller.dexopt(path, uid, pkg.packageName, isa, dexoptNeeded, oatDir, dexoptFlags, mInstaller.dexopt(path, uid, pkg.packageName, isa, dexoptNeeded, oatDir, dexoptFlags, compilerFilter, pkg.volumeUuid, classLoaderContext, pkg.applicationInfo.seInfo, compilerFilter, pkg.volumeUuid, classLoaderContext, pkg.applicationInfo.seInfo, false /* downgrade*/, pkg.applicationInfo.targetSdkVersion, false /* downgrade*/, pkg.applicationInfo.targetSdkVersion, profileName, dexMetadataPath); profileName, dexMetadataPath, getReasonName(compilationReason)); if (packageStats != null) { if (packageStats != null) { long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis(); Loading Loading @@ -399,7 +400,7 @@ public class PackageDexOptimizer { // Note this trades correctness for performance since the resulting slow down is // Note this trades correctness for performance since the resulting slow down is // unacceptable in some cases until b/64530081 is fixed. // unacceptable in some cases until b/64530081 is fixed. String classLoaderContext = SKIP_SHARED_LIBRARY_CHECK; String classLoaderContext = SKIP_SHARED_LIBRARY_CHECK; int reason = options.getCompilationReason(); try { try { for (String isa : dexUseInfo.getLoaderIsas()) { for (String isa : dexUseInfo.getLoaderIsas()) { // Reuse the same dexopt path as for the primary apks. We don't need all the // Reuse the same dexopt path as for the primary apks. We don't need all the Loading @@ -410,7 +411,7 @@ public class PackageDexOptimizer { /*oatDir*/ null, dexoptFlags, /*oatDir*/ null, dexoptFlags, compilerFilter, info.volumeUuid, classLoaderContext, info.seInfoUser, compilerFilter, info.volumeUuid, classLoaderContext, info.seInfoUser, options.isDowngrade(), info.targetSdkVersion, /*profileName*/ null, options.isDowngrade(), info.targetSdkVersion, /*profileName*/ null, /*dexMetadataPath*/ null); /*dexMetadataPath*/ null, getReasonName(reason)); } } return DEX_OPT_PERFORMED; return DEX_OPT_PERFORMED; Loading services/core/java/com/android/server/pm/PackageManagerService.java +10 −10 Original line number Original line Diff line number Diff line Loading @@ -575,6 +575,7 @@ public class PackageManagerService extends IPackageManager.Stub } } // Compilation reasons. // Compilation reasons. public static final int REASON_UNKNOWN = -1; public static final int REASON_FIRST_BOOT = 0; public static final int REASON_FIRST_BOOT = 0; public static final int REASON_BOOT = 1; public static final int REASON_BOOT = 1; public static final int REASON_INSTALL = 2; public static final int REASON_INSTALL = 2; Loading Loading @@ -9710,7 +9711,7 @@ public class PackageManagerService extends IPackageManager.Stub final long startTime = System.nanoTime(); final long startTime = System.nanoTime(); final int[] stats = performDexOptUpgrade(pkgs, mIsPreNUpgrade /* showDialog */, final int[] stats = performDexOptUpgrade(pkgs, mIsPreNUpgrade /* showDialog */, getCompilerFilterForReason(causeFirstBoot ? REASON_FIRST_BOOT : REASON_BOOT), causeFirstBoot ? REASON_FIRST_BOOT : REASON_BOOT, false /* bootComplete */); false /* bootComplete */); final int elapsedTimeSeconds = final int elapsedTimeSeconds = Loading @@ -9737,7 +9738,7 @@ public class PackageManagerService extends IPackageManager.Stub * and {@code numberOfPackagesFailed}. * and {@code numberOfPackagesFailed}. */ */ private int[] performDexOptUpgrade(List<PackageParser.Package> pkgs, boolean showDialog, private int[] performDexOptUpgrade(List<PackageParser.Package> pkgs, boolean showDialog, final String compilerFilter, boolean bootComplete) { final int compilationReason, boolean bootComplete) { int numberOfPackagesVisited = 0; int numberOfPackagesVisited = 0; int numberOfPackagesOptimized = 0; int numberOfPackagesOptimized = 0; Loading Loading @@ -9837,13 +9838,11 @@ public class PackageManagerService extends IPackageManager.Stub } } } } String pkgCompilerFilter = compilerFilter; int pkgCompilationReason = compilationReason; if (useProfileForDexopt) { if (useProfileForDexopt) { // Use background dexopt mode to try and use the profile. Note that this does not // Use background dexopt mode to try and use the profile. Note that this does not // guarantee usage of the profile. // guarantee usage of the profile. pkgCompilerFilter = pkgCompilationReason = PackageManagerService.REASON_BACKGROUND_DEXOPT; PackageManagerServiceCompilerMapping.getCompilerFilterForReason( PackageManagerService.REASON_BACKGROUND_DEXOPT); } } // checkProfiles is false to avoid merging profiles during boot which // checkProfiles is false to avoid merging profiles during boot which Loading @@ -9854,7 +9853,7 @@ public class PackageManagerService extends IPackageManager.Stub int dexoptFlags = bootComplete ? DexoptOptions.DEXOPT_BOOT_COMPLETE : 0; int dexoptFlags = bootComplete ? DexoptOptions.DEXOPT_BOOT_COMPLETE : 0; int primaryDexOptStaus = performDexOptTraced(new DexoptOptions( int primaryDexOptStaus = performDexOptTraced(new DexoptOptions( pkg.packageName, pkg.packageName, pkgCompilerFilter, pkgCompilationReason, dexoptFlags)); dexoptFlags)); switch (primaryDexOptStaus) { switch (primaryDexOptStaus) { Loading Loading @@ -9954,8 +9953,8 @@ public class PackageManagerService extends IPackageManager.Stub int flags = (checkProfiles ? DexoptOptions.DEXOPT_CHECK_FOR_PROFILES_UPDATES : 0) | int flags = (checkProfiles ? DexoptOptions.DEXOPT_CHECK_FOR_PROFILES_UPDATES : 0) | (force ? DexoptOptions.DEXOPT_FORCE : 0) | (force ? DexoptOptions.DEXOPT_FORCE : 0) | (bootComplete ? DexoptOptions.DEXOPT_BOOT_COMPLETE : 0); (bootComplete ? DexoptOptions.DEXOPT_BOOT_COMPLETE : 0); return performDexOpt(new DexoptOptions(packageName, targetCompilerFilter, return performDexOpt(new DexoptOptions(packageName, REASON_UNKNOWN, splitName, flags)); targetCompilerFilter, splitName, flags)); } } /** /** Loading Loading @@ -10064,7 +10063,8 @@ public class PackageManagerService extends IPackageManager.Stub final String[] instructionSets = getAppDexInstructionSets(p.applicationInfo); final String[] instructionSets = getAppDexInstructionSets(p.applicationInfo); if (!deps.isEmpty()) { if (!deps.isEmpty()) { DexoptOptions libraryOptions = new DexoptOptions(options.getPackageName(), DexoptOptions libraryOptions = new DexoptOptions(options.getPackageName(), options.getCompilerFilter(), options.getSplitName(), options.getCompilationReason(), options.getCompilerFilter(), options.getSplitName(), options.getFlags() | DexoptOptions.DEXOPT_AS_SHARED_LIBRARY); options.getFlags() | DexoptOptions.DEXOPT_AS_SHARED_LIBRARY); for (PackageParser.Package depPackage : deps) { for (PackageParser.Package depPackage : deps) { // TODO: Analyze and investigate if we (should) profile libraries. // TODO: Analyze and investigate if we (should) profile libraries. Loading
core/java/com/android/internal/os/ZygoteInit.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -576,7 +576,8 @@ public class ZygoteInit { installd.dexopt(classPathElement, Process.SYSTEM_UID, packageName, installd.dexopt(classPathElement, Process.SYSTEM_UID, packageName, instructionSet, dexoptNeeded, outputPath, dexFlags, compilerFilter, instructionSet, dexoptNeeded, outputPath, dexFlags, compilerFilter, uuid, classLoaderContext, seInfo, false /* downgrade */, uuid, classLoaderContext, seInfo, false /* downgrade */, targetSdkVersion, /*profileName*/ null, /*dexMetadataPath*/ null); targetSdkVersion, /*profileName*/ null, /*dexMetadataPath*/ null, "server-dexopt"); } catch (RemoteException | ServiceSpecificException e) { } catch (RemoteException | ServiceSpecificException e) { // Ignore (but log), we need this on the classpath for fallback mode. // Ignore (but log), we need this on the classpath for fallback mode. Log.w(TAG, "Failed compiling classpath element for system server: " Log.w(TAG, "Failed compiling classpath element for system server: " Loading
services/core/java/com/android/server/pm/Installer.java +3 −3 Original line number Original line Diff line number Diff line Loading @@ -286,14 +286,14 @@ public class Installer extends SystemService { int dexoptNeeded, @Nullable String outputPath, int dexFlags, int dexoptNeeded, @Nullable String outputPath, int dexFlags, String compilerFilter, @Nullable String volumeUuid, @Nullable String sharedLibraries, String compilerFilter, @Nullable String volumeUuid, @Nullable String sharedLibraries, @Nullable String seInfo, boolean downgrade, int targetSdkVersion, @Nullable String seInfo, boolean downgrade, int targetSdkVersion, @Nullable String profileName, @Nullable String dexMetadataPath) @Nullable String profileName, @Nullable String dexMetadataPath, throws InstallerException { @Nullable String compilationReason) throws InstallerException { assertValidInstructionSet(instructionSet); assertValidInstructionSet(instructionSet); if (!checkBeforeRemote()) return; if (!checkBeforeRemote()) return; try { try { mInstalld.dexopt(apkPath, uid, pkgName, instructionSet, dexoptNeeded, outputPath, mInstalld.dexopt(apkPath, uid, pkgName, instructionSet, dexoptNeeded, outputPath, dexFlags, compilerFilter, volumeUuid, sharedLibraries, seInfo, downgrade, dexFlags, compilerFilter, volumeUuid, sharedLibraries, seInfo, downgrade, targetSdkVersion, profileName, dexMetadataPath); targetSdkVersion, profileName, dexMetadataPath, compilationReason); } catch (Exception e) { } catch (Exception e) { throw InstallerException.from(e); throw InstallerException.from(e); } } Loading
services/core/java/com/android/server/pm/OtaDexoptService.java +5 −3 Original line number Original line Diff line number Diff line Loading @@ -262,11 +262,12 @@ public class OtaDexoptService extends IOtaDexopt.Stub { int dexFlags, String compilerFilter, @Nullable String volumeUuid, int dexFlags, String compilerFilter, @Nullable String volumeUuid, @Nullable String sharedLibraries, @Nullable String seInfo, boolean downgrade, @Nullable String sharedLibraries, @Nullable String seInfo, boolean downgrade, int targetSdkVersion, @Nullable String profileName, int targetSdkVersion, @Nullable String profileName, @Nullable String dexMetadataPath) throws InstallerException { @Nullable String dexMetadataPath, @Nullable String dexoptCompilationReason) throws InstallerException { final StringBuilder builder = new StringBuilder(); final StringBuilder builder = new StringBuilder(); // The version. Right now it's 6. // The version. Right now it's 7. builder.append("6 "); builder.append("7 "); builder.append("dexopt"); builder.append("dexopt"); Loading @@ -285,6 +286,7 @@ public class OtaDexoptService extends IOtaDexopt.Stub { encodeParameter(builder, targetSdkVersion); encodeParameter(builder, targetSdkVersion); encodeParameter(builder, profileName); encodeParameter(builder, profileName); encodeParameter(builder, dexMetadataPath); encodeParameter(builder, dexMetadataPath); encodeParameter(builder, dexoptCompilationReason); commands.add(builder.toString()); commands.add(builder.toString()); } } Loading
services/core/java/com/android/server/pm/PackageDexOptimizer.java +8 −7 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.util.Slog; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.GuardedBy; import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.IndentingPrintWriter; import com.android.server.pm.Installer.InstallerException; import com.android.server.pm.Installer.InstallerException; import com.android.server.pm.dex.DexManager; import com.android.server.pm.dex.DexoptOptions; import com.android.server.pm.dex.DexoptOptions; import com.android.server.pm.dex.DexoptUtils; import com.android.server.pm.dex.DexoptUtils; import com.android.server.pm.dex.PackageDexUsage; import com.android.server.pm.dex.PackageDexUsage; Loading Loading @@ -63,7 +62,8 @@ import static com.android.server.pm.InstructionSets.getDexCodeInstructionSets; import static com.android.server.pm.PackageManagerService.WATCHDOG_TIMEOUT; import static com.android.server.pm.PackageManagerService.WATCHDOG_TIMEOUT; import static dalvik.system.DexFile.getNonProfileGuidedCompilerFilter; import static com.android.server.pm.PackageManagerServiceCompilerMapping.getReasonName; import static dalvik.system.DexFile.getSafeModeCompilerFilter; import static dalvik.system.DexFile.getSafeModeCompilerFilter; import static dalvik.system.DexFile.isProfileGuidedCompilerFilter; import static dalvik.system.DexFile.isProfileGuidedCompilerFilter; Loading Loading @@ -236,7 +236,8 @@ public class PackageDexOptimizer { for (String dexCodeIsa : dexCodeInstructionSets) { for (String dexCodeIsa : dexCodeInstructionSets) { int newResult = dexOptPath(pkg, path, dexCodeIsa, compilerFilter, int newResult = dexOptPath(pkg, path, dexCodeIsa, compilerFilter, profileUpdated, classLoaderContexts[i], dexoptFlags, sharedGid, profileUpdated, classLoaderContexts[i], dexoptFlags, sharedGid, packageStats, options.isDowngrade(), profileName, dexMetadataPath); packageStats, options.isDowngrade(), profileName, dexMetadataPath, options.getCompilationReason()); // The end result is: // The end result is: // - FAILED if any path failed, // - FAILED if any path failed, // - PERFORMED if at least one path needed compilation, // - PERFORMED if at least one path needed compilation, Loading @@ -261,7 +262,7 @@ public class PackageDexOptimizer { private int dexOptPath(PackageParser.Package pkg, String path, String isa, private int dexOptPath(PackageParser.Package pkg, String path, String isa, String compilerFilter, boolean profileUpdated, String classLoaderContext, String compilerFilter, boolean profileUpdated, String classLoaderContext, int dexoptFlags, int uid, CompilerStats.PackageStats packageStats, boolean downgrade, int dexoptFlags, int uid, CompilerStats.PackageStats packageStats, boolean downgrade, String profileName, String dexMetadataPath) { String profileName, String dexMetadataPath, int compilationReason) { int dexoptNeeded = getDexoptNeeded(path, isa, compilerFilter, classLoaderContext, int dexoptNeeded = getDexoptNeeded(path, isa, compilerFilter, classLoaderContext, profileUpdated, downgrade); profileUpdated, downgrade); if (Math.abs(dexoptNeeded) == DexFile.NO_DEXOPT_NEEDED) { if (Math.abs(dexoptNeeded) == DexFile.NO_DEXOPT_NEEDED) { Loading @@ -288,7 +289,7 @@ public class PackageDexOptimizer { mInstaller.dexopt(path, uid, pkg.packageName, isa, dexoptNeeded, oatDir, dexoptFlags, mInstaller.dexopt(path, uid, pkg.packageName, isa, dexoptNeeded, oatDir, dexoptFlags, compilerFilter, pkg.volumeUuid, classLoaderContext, pkg.applicationInfo.seInfo, compilerFilter, pkg.volumeUuid, classLoaderContext, pkg.applicationInfo.seInfo, false /* downgrade*/, pkg.applicationInfo.targetSdkVersion, false /* downgrade*/, pkg.applicationInfo.targetSdkVersion, profileName, dexMetadataPath); profileName, dexMetadataPath, getReasonName(compilationReason)); if (packageStats != null) { if (packageStats != null) { long endTime = System.currentTimeMillis(); long endTime = System.currentTimeMillis(); Loading Loading @@ -399,7 +400,7 @@ public class PackageDexOptimizer { // Note this trades correctness for performance since the resulting slow down is // Note this trades correctness for performance since the resulting slow down is // unacceptable in some cases until b/64530081 is fixed. // unacceptable in some cases until b/64530081 is fixed. String classLoaderContext = SKIP_SHARED_LIBRARY_CHECK; String classLoaderContext = SKIP_SHARED_LIBRARY_CHECK; int reason = options.getCompilationReason(); try { try { for (String isa : dexUseInfo.getLoaderIsas()) { for (String isa : dexUseInfo.getLoaderIsas()) { // Reuse the same dexopt path as for the primary apks. We don't need all the // Reuse the same dexopt path as for the primary apks. We don't need all the Loading @@ -410,7 +411,7 @@ public class PackageDexOptimizer { /*oatDir*/ null, dexoptFlags, /*oatDir*/ null, dexoptFlags, compilerFilter, info.volumeUuid, classLoaderContext, info.seInfoUser, compilerFilter, info.volumeUuid, classLoaderContext, info.seInfoUser, options.isDowngrade(), info.targetSdkVersion, /*profileName*/ null, options.isDowngrade(), info.targetSdkVersion, /*profileName*/ null, /*dexMetadataPath*/ null); /*dexMetadataPath*/ null, getReasonName(reason)); } } return DEX_OPT_PERFORMED; return DEX_OPT_PERFORMED; Loading
services/core/java/com/android/server/pm/PackageManagerService.java +10 −10 Original line number Original line Diff line number Diff line Loading @@ -575,6 +575,7 @@ public class PackageManagerService extends IPackageManager.Stub } } // Compilation reasons. // Compilation reasons. public static final int REASON_UNKNOWN = -1; public static final int REASON_FIRST_BOOT = 0; public static final int REASON_FIRST_BOOT = 0; public static final int REASON_BOOT = 1; public static final int REASON_BOOT = 1; public static final int REASON_INSTALL = 2; public static final int REASON_INSTALL = 2; Loading Loading @@ -9710,7 +9711,7 @@ public class PackageManagerService extends IPackageManager.Stub final long startTime = System.nanoTime(); final long startTime = System.nanoTime(); final int[] stats = performDexOptUpgrade(pkgs, mIsPreNUpgrade /* showDialog */, final int[] stats = performDexOptUpgrade(pkgs, mIsPreNUpgrade /* showDialog */, getCompilerFilterForReason(causeFirstBoot ? REASON_FIRST_BOOT : REASON_BOOT), causeFirstBoot ? REASON_FIRST_BOOT : REASON_BOOT, false /* bootComplete */); false /* bootComplete */); final int elapsedTimeSeconds = final int elapsedTimeSeconds = Loading @@ -9737,7 +9738,7 @@ public class PackageManagerService extends IPackageManager.Stub * and {@code numberOfPackagesFailed}. * and {@code numberOfPackagesFailed}. */ */ private int[] performDexOptUpgrade(List<PackageParser.Package> pkgs, boolean showDialog, private int[] performDexOptUpgrade(List<PackageParser.Package> pkgs, boolean showDialog, final String compilerFilter, boolean bootComplete) { final int compilationReason, boolean bootComplete) { int numberOfPackagesVisited = 0; int numberOfPackagesVisited = 0; int numberOfPackagesOptimized = 0; int numberOfPackagesOptimized = 0; Loading Loading @@ -9837,13 +9838,11 @@ public class PackageManagerService extends IPackageManager.Stub } } } } String pkgCompilerFilter = compilerFilter; int pkgCompilationReason = compilationReason; if (useProfileForDexopt) { if (useProfileForDexopt) { // Use background dexopt mode to try and use the profile. Note that this does not // Use background dexopt mode to try and use the profile. Note that this does not // guarantee usage of the profile. // guarantee usage of the profile. pkgCompilerFilter = pkgCompilationReason = PackageManagerService.REASON_BACKGROUND_DEXOPT; PackageManagerServiceCompilerMapping.getCompilerFilterForReason( PackageManagerService.REASON_BACKGROUND_DEXOPT); } } // checkProfiles is false to avoid merging profiles during boot which // checkProfiles is false to avoid merging profiles during boot which Loading @@ -9854,7 +9853,7 @@ public class PackageManagerService extends IPackageManager.Stub int dexoptFlags = bootComplete ? DexoptOptions.DEXOPT_BOOT_COMPLETE : 0; int dexoptFlags = bootComplete ? DexoptOptions.DEXOPT_BOOT_COMPLETE : 0; int primaryDexOptStaus = performDexOptTraced(new DexoptOptions( int primaryDexOptStaus = performDexOptTraced(new DexoptOptions( pkg.packageName, pkg.packageName, pkgCompilerFilter, pkgCompilationReason, dexoptFlags)); dexoptFlags)); switch (primaryDexOptStaus) { switch (primaryDexOptStaus) { Loading Loading @@ -9954,8 +9953,8 @@ public class PackageManagerService extends IPackageManager.Stub int flags = (checkProfiles ? DexoptOptions.DEXOPT_CHECK_FOR_PROFILES_UPDATES : 0) | int flags = (checkProfiles ? DexoptOptions.DEXOPT_CHECK_FOR_PROFILES_UPDATES : 0) | (force ? DexoptOptions.DEXOPT_FORCE : 0) | (force ? DexoptOptions.DEXOPT_FORCE : 0) | (bootComplete ? DexoptOptions.DEXOPT_BOOT_COMPLETE : 0); (bootComplete ? DexoptOptions.DEXOPT_BOOT_COMPLETE : 0); return performDexOpt(new DexoptOptions(packageName, targetCompilerFilter, return performDexOpt(new DexoptOptions(packageName, REASON_UNKNOWN, splitName, flags)); targetCompilerFilter, splitName, flags)); } } /** /** Loading Loading @@ -10064,7 +10063,8 @@ public class PackageManagerService extends IPackageManager.Stub final String[] instructionSets = getAppDexInstructionSets(p.applicationInfo); final String[] instructionSets = getAppDexInstructionSets(p.applicationInfo); if (!deps.isEmpty()) { if (!deps.isEmpty()) { DexoptOptions libraryOptions = new DexoptOptions(options.getPackageName(), DexoptOptions libraryOptions = new DexoptOptions(options.getPackageName(), options.getCompilerFilter(), options.getSplitName(), options.getCompilationReason(), options.getCompilerFilter(), options.getSplitName(), options.getFlags() | DexoptOptions.DEXOPT_AS_SHARED_LIBRARY); options.getFlags() | DexoptOptions.DEXOPT_AS_SHARED_LIBRARY); for (PackageParser.Package depPackage : deps) { for (PackageParser.Package depPackage : deps) { // TODO: Analyze and investigate if we (should) profile libraries. // TODO: Analyze and investigate if we (should) profile libraries.