Loading core/java/android/content/pm/IPackageManager.aidl +4 −8 Original line number Diff line number Diff line Loading @@ -459,23 +459,19 @@ interface IPackageManager { /** * Ask the package manager to perform dex-opt (if needed) on the given * package and for the given instruction set if it already hasn't done * so. * * If the supplied instructionSet is null, the package manager will use * the packages default instruction set. * package if it already hasn't done so. * * In most cases, apps are dexopted in advance and this function will * be a no-op. */ boolean performDexOptIfNeeded(String packageName, String instructionSet); boolean performDexOptIfNeeded(String packageName); /** * Ask the package manager to perform a dex-opt for the given reason. The package * manager will map the reason to a compiler filter according to the current system * configuration. */ boolean performDexOpt(String packageName, String instructionSet, boolean checkProfiles, boolean performDexOpt(String packageName, boolean checkProfiles, int compileReason, boolean force); /** * Ask the package manager to perform a dex-opt with the given compiler filter. Loading @@ -483,7 +479,7 @@ interface IPackageManager { * Note: exposed only for the shell command to allow moving packages explicitly to a * definite state. */ boolean performDexOptMode(String packageName, String instructionSet, boolean checkProfiles, boolean performDexOptMode(String packageName, boolean checkProfiles, String targetCompilerFilter, boolean force); void forceDexOpt(String packageName); Loading services/core/java/com/android/server/pm/BackgroundDexOptService.java +0 −2 Original line number Diff line number Diff line Loading @@ -154,7 +154,6 @@ public class BackgroundDexOptService extends JobService { // behave differently than "pm.dexopt.bg-dexopt=speed-profile" but that's a // trade-off worth doing to save boot time work. pm.performDexOpt(pkg, /* instruction set */ null, /* checkProfiles */ false, PackageManagerService.REASON_BOOT, /* force */ false); Loading Loading @@ -192,7 +191,6 @@ public class BackgroundDexOptService extends JobService { // Optimize package if needed. Note that there can be no race between // concurrent jobs because PackageDexOptimizer.performDexOpt is synchronized. if (pm.performDexOpt(pkg, /* instruction set */ null, /* checkProfiles */ true, PackageManagerService.REASON_BACKGROUND_DEXOPT, /* force */ false)) { Loading services/core/java/com/android/server/pm/PackageManagerService.java +13 −22 Original line number Diff line number Diff line Loading @@ -7267,7 +7267,6 @@ public class PackageManagerService extends IPackageManager.Stub { // behave differently than "pm.dexopt.bg-dexopt=speed-profile" but that's a // trade-off worth doing to save boot time work. int dexOptStatus = performDexOptTraced(pkg.packageName, null /* instructionSet */, false /* checkProfiles */, getCompilerFilterForReason(causeFirstBoot ? REASON_FIRST_BOOT : REASON_BOOT), false /* force */); Loading Loading @@ -7309,33 +7308,33 @@ public class PackageManagerService extends IPackageManager.Stub { // TODO: this is not used nor needed. Delete it. @Override public boolean performDexOptIfNeeded(String packageName, String instructionSet) { int dexOptStatus = performDexOptTraced(packageName, instructionSet, public boolean performDexOptIfNeeded(String packageName) { int dexOptStatus = performDexOptTraced(packageName, false /* checkProfiles */, getFullCompilerFilter(), false /* force */); return dexOptStatus != PackageDexOptimizer.DEX_OPT_FAILED; } @Override public boolean performDexOpt(String packageName, String instructionSet, public boolean performDexOpt(String packageName, boolean checkProfiles, int compileReason, boolean force) { int dexOptStatus = performDexOptTraced(packageName, instructionSet, checkProfiles, int dexOptStatus = performDexOptTraced(packageName, checkProfiles, getCompilerFilterForReason(compileReason), force); return dexOptStatus != PackageDexOptimizer.DEX_OPT_FAILED; } @Override public boolean performDexOptMode(String packageName, String instructionSet, public boolean performDexOptMode(String packageName, boolean checkProfiles, String targetCompilerFilter, boolean force) { int dexOptStatus = performDexOptTraced(packageName, instructionSet, checkProfiles, int dexOptStatus = performDexOptTraced(packageName, checkProfiles, targetCompilerFilter, force); return dexOptStatus != PackageDexOptimizer.DEX_OPT_FAILED; } private int performDexOptTraced(String packageName, String instructionSet, private int performDexOptTraced(String packageName, boolean checkProfiles, String targetCompilerFilter, boolean force) { Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt"); try { return performDexOptInternal(packageName, instructionSet, checkProfiles, return performDexOptInternal(packageName, checkProfiles, targetCompilerFilter, force); } finally { Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); Loading @@ -7344,10 +7343,9 @@ public class PackageManagerService extends IPackageManager.Stub { // Run dexopt on a given package. Returns true if dexopt did not fail, i.e. // if the package can now be considered up to date for the given filter. private int performDexOptInternal(String packageName, String instructionSet, private int performDexOptInternal(String packageName, boolean checkProfiles, String targetCompilerFilter, boolean force) { PackageParser.Package p; final String targetInstructionSet; synchronized (mPackages) { p = mPackages.get(packageName); if (p == null) { Loading @@ -7355,15 +7353,11 @@ public class PackageManagerService extends IPackageManager.Stub { return PackageDexOptimizer.DEX_OPT_FAILED; } mPackageUsage.write(false); targetInstructionSet = instructionSet != null ? instructionSet : getPrimaryInstructionSet(p.applicationInfo); } long callingId = Binder.clearCallingIdentity(); try { synchronized (mInstallLock) { final String[] instructionSets = new String[] { targetInstructionSet }; return performDexOptInternalWithDependenciesLI(p, instructionSets, checkProfiles, return performDexOptInternalWithDependenciesLI(p, checkProfiles, targetCompilerFilter, force); } } finally { Loading @@ -7384,7 +7378,7 @@ public class PackageManagerService extends IPackageManager.Stub { } private int performDexOptInternalWithDependenciesLI(PackageParser.Package p, String instructionSets[], boolean checkProfiles, String targetCompilerFilter, boolean checkProfiles, String targetCompilerFilter, boolean force) { // Select the dex optimizer based on the force parameter. // Note: The force option is rarely used (cmdline input for testing, mostly), so it's OK to Loading @@ -7396,6 +7390,7 @@ public class PackageManagerService extends IPackageManager.Stub { // Optimize all dependencies first. Note: we ignore the return value and march on // on errors. Collection<PackageParser.Package> deps = findSharedNonSystemLibraries(p); final String[] instructionSets = getAppDexInstructionSets(p.applicationInfo); if (!deps.isEmpty()) { for (PackageParser.Package depPackage : deps) { // TODO: Analyze and investigate if we (should) profile libraries. Loading @@ -7405,7 +7400,6 @@ public class PackageManagerService extends IPackageManager.Stub { getCompilerFilterForReason(REASON_NON_SYSTEM_LIBRARY)); } } return pdo.performDexOpt(p, p.usesLibraryFiles, instructionSets, checkProfiles, targetCompilerFilter); } Loading Loading @@ -7477,14 +7471,11 @@ public class PackageManagerService extends IPackageManager.Stub { } synchronized (mInstallLock) { final String[] instructionSets = new String[] { getPrimaryInstructionSet(pkg.applicationInfo) }; Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt"); // Whoever is calling forceDexOpt wants a fully compiled package. // Don't use profiles since that may cause compilation to be skipped. final int res = performDexOptInternalWithDependenciesLI(pkg, instructionSets, final int res = performDexOptInternalWithDependenciesLI(pkg, false /* checkProfiles */, getCompilerFilterForReason(REASON_FORCED_DEXOPT), true /* force */); Loading services/core/java/com/android/server/pm/PackageManagerShellCommand.java +1 −1 Original line number Diff line number Diff line Loading @@ -358,7 +358,7 @@ class PackageManagerShellCommand extends ShellCommand { mInterface.clearApplicationProfileData(packageName); } boolean result = mInterface.performDexOptMode(packageName, null /* instructionSet */, boolean result = mInterface.performDexOptMode(packageName, checkProfiles, targetCompilerFilter, forceCompilation); if (!result) { failedPackages.add(packageName); Loading Loading
core/java/android/content/pm/IPackageManager.aidl +4 −8 Original line number Diff line number Diff line Loading @@ -459,23 +459,19 @@ interface IPackageManager { /** * Ask the package manager to perform dex-opt (if needed) on the given * package and for the given instruction set if it already hasn't done * so. * * If the supplied instructionSet is null, the package manager will use * the packages default instruction set. * package if it already hasn't done so. * * In most cases, apps are dexopted in advance and this function will * be a no-op. */ boolean performDexOptIfNeeded(String packageName, String instructionSet); boolean performDexOptIfNeeded(String packageName); /** * Ask the package manager to perform a dex-opt for the given reason. The package * manager will map the reason to a compiler filter according to the current system * configuration. */ boolean performDexOpt(String packageName, String instructionSet, boolean checkProfiles, boolean performDexOpt(String packageName, boolean checkProfiles, int compileReason, boolean force); /** * Ask the package manager to perform a dex-opt with the given compiler filter. Loading @@ -483,7 +479,7 @@ interface IPackageManager { * Note: exposed only for the shell command to allow moving packages explicitly to a * definite state. */ boolean performDexOptMode(String packageName, String instructionSet, boolean checkProfiles, boolean performDexOptMode(String packageName, boolean checkProfiles, String targetCompilerFilter, boolean force); void forceDexOpt(String packageName); Loading
services/core/java/com/android/server/pm/BackgroundDexOptService.java +0 −2 Original line number Diff line number Diff line Loading @@ -154,7 +154,6 @@ public class BackgroundDexOptService extends JobService { // behave differently than "pm.dexopt.bg-dexopt=speed-profile" but that's a // trade-off worth doing to save boot time work. pm.performDexOpt(pkg, /* instruction set */ null, /* checkProfiles */ false, PackageManagerService.REASON_BOOT, /* force */ false); Loading Loading @@ -192,7 +191,6 @@ public class BackgroundDexOptService extends JobService { // Optimize package if needed. Note that there can be no race between // concurrent jobs because PackageDexOptimizer.performDexOpt is synchronized. if (pm.performDexOpt(pkg, /* instruction set */ null, /* checkProfiles */ true, PackageManagerService.REASON_BACKGROUND_DEXOPT, /* force */ false)) { Loading
services/core/java/com/android/server/pm/PackageManagerService.java +13 −22 Original line number Diff line number Diff line Loading @@ -7267,7 +7267,6 @@ public class PackageManagerService extends IPackageManager.Stub { // behave differently than "pm.dexopt.bg-dexopt=speed-profile" but that's a // trade-off worth doing to save boot time work. int dexOptStatus = performDexOptTraced(pkg.packageName, null /* instructionSet */, false /* checkProfiles */, getCompilerFilterForReason(causeFirstBoot ? REASON_FIRST_BOOT : REASON_BOOT), false /* force */); Loading Loading @@ -7309,33 +7308,33 @@ public class PackageManagerService extends IPackageManager.Stub { // TODO: this is not used nor needed. Delete it. @Override public boolean performDexOptIfNeeded(String packageName, String instructionSet) { int dexOptStatus = performDexOptTraced(packageName, instructionSet, public boolean performDexOptIfNeeded(String packageName) { int dexOptStatus = performDexOptTraced(packageName, false /* checkProfiles */, getFullCompilerFilter(), false /* force */); return dexOptStatus != PackageDexOptimizer.DEX_OPT_FAILED; } @Override public boolean performDexOpt(String packageName, String instructionSet, public boolean performDexOpt(String packageName, boolean checkProfiles, int compileReason, boolean force) { int dexOptStatus = performDexOptTraced(packageName, instructionSet, checkProfiles, int dexOptStatus = performDexOptTraced(packageName, checkProfiles, getCompilerFilterForReason(compileReason), force); return dexOptStatus != PackageDexOptimizer.DEX_OPT_FAILED; } @Override public boolean performDexOptMode(String packageName, String instructionSet, public boolean performDexOptMode(String packageName, boolean checkProfiles, String targetCompilerFilter, boolean force) { int dexOptStatus = performDexOptTraced(packageName, instructionSet, checkProfiles, int dexOptStatus = performDexOptTraced(packageName, checkProfiles, targetCompilerFilter, force); return dexOptStatus != PackageDexOptimizer.DEX_OPT_FAILED; } private int performDexOptTraced(String packageName, String instructionSet, private int performDexOptTraced(String packageName, boolean checkProfiles, String targetCompilerFilter, boolean force) { Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt"); try { return performDexOptInternal(packageName, instructionSet, checkProfiles, return performDexOptInternal(packageName, checkProfiles, targetCompilerFilter, force); } finally { Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER); Loading @@ -7344,10 +7343,9 @@ public class PackageManagerService extends IPackageManager.Stub { // Run dexopt on a given package. Returns true if dexopt did not fail, i.e. // if the package can now be considered up to date for the given filter. private int performDexOptInternal(String packageName, String instructionSet, private int performDexOptInternal(String packageName, boolean checkProfiles, String targetCompilerFilter, boolean force) { PackageParser.Package p; final String targetInstructionSet; synchronized (mPackages) { p = mPackages.get(packageName); if (p == null) { Loading @@ -7355,15 +7353,11 @@ public class PackageManagerService extends IPackageManager.Stub { return PackageDexOptimizer.DEX_OPT_FAILED; } mPackageUsage.write(false); targetInstructionSet = instructionSet != null ? instructionSet : getPrimaryInstructionSet(p.applicationInfo); } long callingId = Binder.clearCallingIdentity(); try { synchronized (mInstallLock) { final String[] instructionSets = new String[] { targetInstructionSet }; return performDexOptInternalWithDependenciesLI(p, instructionSets, checkProfiles, return performDexOptInternalWithDependenciesLI(p, checkProfiles, targetCompilerFilter, force); } } finally { Loading @@ -7384,7 +7378,7 @@ public class PackageManagerService extends IPackageManager.Stub { } private int performDexOptInternalWithDependenciesLI(PackageParser.Package p, String instructionSets[], boolean checkProfiles, String targetCompilerFilter, boolean checkProfiles, String targetCompilerFilter, boolean force) { // Select the dex optimizer based on the force parameter. // Note: The force option is rarely used (cmdline input for testing, mostly), so it's OK to Loading @@ -7396,6 +7390,7 @@ public class PackageManagerService extends IPackageManager.Stub { // Optimize all dependencies first. Note: we ignore the return value and march on // on errors. Collection<PackageParser.Package> deps = findSharedNonSystemLibraries(p); final String[] instructionSets = getAppDexInstructionSets(p.applicationInfo); if (!deps.isEmpty()) { for (PackageParser.Package depPackage : deps) { // TODO: Analyze and investigate if we (should) profile libraries. Loading @@ -7405,7 +7400,6 @@ public class PackageManagerService extends IPackageManager.Stub { getCompilerFilterForReason(REASON_NON_SYSTEM_LIBRARY)); } } return pdo.performDexOpt(p, p.usesLibraryFiles, instructionSets, checkProfiles, targetCompilerFilter); } Loading Loading @@ -7477,14 +7471,11 @@ public class PackageManagerService extends IPackageManager.Stub { } synchronized (mInstallLock) { final String[] instructionSets = new String[] { getPrimaryInstructionSet(pkg.applicationInfo) }; Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt"); // Whoever is calling forceDexOpt wants a fully compiled package. // Don't use profiles since that may cause compilation to be skipped. final int res = performDexOptInternalWithDependenciesLI(pkg, instructionSets, final int res = performDexOptInternalWithDependenciesLI(pkg, false /* checkProfiles */, getCompilerFilterForReason(REASON_FORCED_DEXOPT), true /* force */); Loading
services/core/java/com/android/server/pm/PackageManagerShellCommand.java +1 −1 Original line number Diff line number Diff line Loading @@ -358,7 +358,7 @@ class PackageManagerShellCommand extends ShellCommand { mInterface.clearApplicationProfileData(packageName); } boolean result = mInterface.performDexOptMode(packageName, null /* instructionSet */, boolean result = mInterface.performDexOptMode(packageName, checkProfiles, targetCompilerFilter, forceCompilation); if (!result) { failedPackages.add(packageName); Loading