Loading core/java/android/app/LoadedApk.java +17 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.Objects; final class IntentReceiverLeaked extends AndroidRuntimeException { public IntentReceiverLeaked(String msg) { Loading Loading @@ -252,6 +253,22 @@ public final class LoadedApk { } if (mIncludeCode && !mPackageName.equals("android")) { // Avoid the binder call when the package is the current application package. // The activity manager will perform ensure that dexopt is performed before // spinning up the process. if (!Objects.equals(mPackageName, ActivityThread.currentPackageName())) { final String isa = VMRuntime.getRuntime().vmInstructionSet(); try { // TODO: We can probably do away with the isa argument since // the AM and PM have enough information to figure this out // themselves. If we do need it, we should match it against the // list of devices ISAs before sending it down to installd. ActivityThread.getPackageManager().performDexOptIfNeeded(mPackageName, isa); } catch (RemoteException re) { // Ignored. } } final ArrayList<String> zipPaths = new ArrayList<>(); final ArrayList<String> libPaths = new ArrayList<>(); Loading core/java/android/content/pm/IPackageManager.aidl +9 −3 Original line number Diff line number Diff line Loading @@ -384,10 +384,16 @@ interface IPackageManager { /** * Ask the package manager to perform dex-opt (if needed) on the given * package, if it already hasn't done mode. Only does this if running * in the special development "no pre-dexopt" mode. * 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. * * In most cases, apps are dexopted in advance and this function will * be a no-op. */ boolean performDexOpt(String packageName); boolean performDexOptIfNeeded(String packageName, String instructionSet); /** * Update status of external media on the package manager to scan and Loading core/java/android/content/pm/PackageParser.java +1 −1 Original line number Diff line number Diff line Loading @@ -4201,7 +4201,7 @@ public class PackageParser { public int mPreferredOrder = 0; // For use by package manager to keep track of where it needs to do dexopt. public boolean mDexOptNeeded = true; public final ArraySet<String> mDexOptPerformed = new ArraySet<>(4); // For use by package manager to keep track of when a package was last used. public long mLastPackageUsageTimeInMills; Loading services/core/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -2809,7 +2809,7 @@ public final class ActivityManagerService extends ActivityManagerNative void ensurePackageDexOpt(String packageName) { IPackageManager pm = AppGlobals.getPackageManager(); try { if (pm.performDexOpt(packageName)) { if (pm.performDexOptIfNeeded(packageName, null /* instruction set */)) { mDidDexOpt = true; } } catch (RemoteException e) { Loading services/core/java/com/android/server/pm/BackgroundDexOptService.java +1 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ public class BackgroundDexOptService extends JobService { schedule(BackgroundDexOptService.this); return; } pm.performDexOpt(pkg, false); pm.performDexOpt(pkg, null /* instruction set */, false); } // ran to completion, so we abandon our timeslice and do not reschedule jobFinished(jobParams, false); Loading Loading
core/java/android/app/LoadedApk.java +17 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ import java.net.URL; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.Objects; final class IntentReceiverLeaked extends AndroidRuntimeException { public IntentReceiverLeaked(String msg) { Loading Loading @@ -252,6 +253,22 @@ public final class LoadedApk { } if (mIncludeCode && !mPackageName.equals("android")) { // Avoid the binder call when the package is the current application package. // The activity manager will perform ensure that dexopt is performed before // spinning up the process. if (!Objects.equals(mPackageName, ActivityThread.currentPackageName())) { final String isa = VMRuntime.getRuntime().vmInstructionSet(); try { // TODO: We can probably do away with the isa argument since // the AM and PM have enough information to figure this out // themselves. If we do need it, we should match it against the // list of devices ISAs before sending it down to installd. ActivityThread.getPackageManager().performDexOptIfNeeded(mPackageName, isa); } catch (RemoteException re) { // Ignored. } } final ArrayList<String> zipPaths = new ArrayList<>(); final ArrayList<String> libPaths = new ArrayList<>(); Loading
core/java/android/content/pm/IPackageManager.aidl +9 −3 Original line number Diff line number Diff line Loading @@ -384,10 +384,16 @@ interface IPackageManager { /** * Ask the package manager to perform dex-opt (if needed) on the given * package, if it already hasn't done mode. Only does this if running * in the special development "no pre-dexopt" mode. * 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. * * In most cases, apps are dexopted in advance and this function will * be a no-op. */ boolean performDexOpt(String packageName); boolean performDexOptIfNeeded(String packageName, String instructionSet); /** * Update status of external media on the package manager to scan and Loading
core/java/android/content/pm/PackageParser.java +1 −1 Original line number Diff line number Diff line Loading @@ -4201,7 +4201,7 @@ public class PackageParser { public int mPreferredOrder = 0; // For use by package manager to keep track of where it needs to do dexopt. public boolean mDexOptNeeded = true; public final ArraySet<String> mDexOptPerformed = new ArraySet<>(4); // For use by package manager to keep track of when a package was last used. public long mLastPackageUsageTimeInMills; Loading
services/core/java/com/android/server/am/ActivityManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -2809,7 +2809,7 @@ public final class ActivityManagerService extends ActivityManagerNative void ensurePackageDexOpt(String packageName) { IPackageManager pm = AppGlobals.getPackageManager(); try { if (pm.performDexOpt(packageName)) { if (pm.performDexOptIfNeeded(packageName, null /* instruction set */)) { mDidDexOpt = true; } } catch (RemoteException e) { Loading
services/core/java/com/android/server/pm/BackgroundDexOptService.java +1 −1 Original line number Diff line number Diff line Loading @@ -75,7 +75,7 @@ public class BackgroundDexOptService extends JobService { schedule(BackgroundDexOptService.this); return; } pm.performDexOpt(pkg, false); pm.performDexOpt(pkg, null /* instruction set */, false); } // ran to completion, so we abandon our timeslice and do not reschedule jobFinished(jobParams, false); Loading