diff options
author | Narayan Kamath <narayan@google.com> | 2014-07-14 13:18:43 +0100 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2014-07-16 19:23:52 +0100 |
commit | 2053168eb4506e2f8795afdbe9731c6451e1589c (patch) | |
tree | 876def8c6e4a36ad5dfc2e51fe6beb18e317f608 /core/java/android/content | |
parent | 93a412ea39cb585dc8e0fa97936c1d0925d0993b (diff) | |
download | frameworks_base-2053168eb4506e2f8795afdbe9731c6451e1589c.zip frameworks_base-2053168eb4506e2f8795afdbe9731c6451e1589c.tar.gz frameworks_base-2053168eb4506e2f8795afdbe9731c6451e1589c.tar.bz2 |
Dexopt for Context.createPackageContext when code is included.
The package manager now keeps track of per ISA dex-opt state.
There are two important things to keep in mind here :
- dexopt can potentially be very slow. In cases where the target
package hasn't been dexopted yet, this can take multiple seconds
and may cause an ANR in the caller if the context is being
created from the main thread.
- We will need to remove the constraint that dexopt can only be
requested by the system (or root). Apps will implicitly be
requesting dexopt by asking for package contexts with code included.
It's important to note that unlike dalvik, the dexopt stage in ART
isn't optional. ART cannot load classes directly from dex files.
bug: 15313272
Change-Id: I0bd6c323a9c1f62f1c08f6292b7f0f7f08942726
Diffstat (limited to 'core/java/android/content')
-rw-r--r-- | core/java/android/content/pm/IPackageManager.aidl | 12 | ||||
-rw-r--r-- | core/java/android/content/pm/PackageParser.java | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl index 3a98f5d..eb46cf0 100644 --- a/core/java/android/content/pm/IPackageManager.aidl +++ b/core/java/android/content/pm/IPackageManager.aidl @@ -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 diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 43c2b15..ab33d75 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -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; |