diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/content/pm/ApplicationInfo.java | 22 | ||||
| -rw-r--r-- | core/java/android/content/pm/PackageParser.java | 24 | ||||
| -rw-r--r-- | core/java/android/view/LayoutInflater.java | 3 |
3 files changed, 19 insertions, 30 deletions
diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java index 1358bc25a07b..b27c5dc1b457 100644 --- a/core/java/android/content/pm/ApplicationInfo.java +++ b/core/java/android/content/pm/ApplicationInfo.java @@ -640,19 +640,15 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { public static final int PRIVATE_FLAG_HAS_FRAGILE_USER_DATA = 1 << 24; /** - * Indicate whether this application prefers code integrity, that is, run only code that is - * signed. This requires android:extractNativeLibs to be "false", as well as .dex and .so (if - * any) stored uncompressed inside the APK, which is signed. At run time, the implications - * include: - * - * <ul> - * <li>ART will JIT the dex code directly from the APK. There may be performance characteristic - * changes depend on the actual workload. - * </ul> + * Indicates whether this application wants to use the embedded dex in the APK, rather than + * extracted or locally compiled variants. This keeps the dex code protected by the APK + * signature. Such apps will always run in JIT mode (same when they are first installed), and + * the system will never generate ahead-of-time compiled code for them. Depending on the app's + * workload, there may be some run time performance change, noteably the cold start time. * * @hide */ - public static final int PRIVATE_FLAG_PREFER_CODE_INTEGRITY = 1 << 25; + public static final int PRIVATE_FLAG_USE_EMBEDDED_DEX = 1 << 25; /** @hide */ @IntDef(flag = true, prefix = { "PRIVATE_FLAG_" }, value = { @@ -669,7 +665,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { PRIVATE_FLAG_ISOLATED_SPLIT_LOADING, PRIVATE_FLAG_OEM, PRIVATE_FLAG_PARTIALLY_DIRECT_BOOT_AWARE, - PRIVATE_FLAG_PREFER_CODE_INTEGRITY, + PRIVATE_FLAG_USE_EMBEDDED_DEX, PRIVATE_FLAG_PRIVILEGED, PRIVATE_FLAG_PRODUCT, PRIVATE_FLAG_PRODUCT_SERVICES, @@ -1962,8 +1958,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { } /** @hide */ - public boolean isCodeIntegrityPreferred() { - return (privateFlags & PRIVATE_FLAG_PREFER_CODE_INTEGRITY) != 0; + public boolean isEmbeddedDexUsed() { + return (privateFlags & PRIVATE_FLAG_USE_EMBEDDED_DEX) != 0; } /** diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 1fab443629a4..8578b4af4f9a 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -475,7 +475,7 @@ public class PackageParser { public final boolean extractNativeLibs; public final boolean isolatedSplits; public final boolean isSplitRequired; - public final boolean preferCodeIntegrity; + public final boolean useEmbeddedDex; public ApkLite(String codePath, String packageName, String splitName, boolean isFeatureSplit, @@ -484,7 +484,7 @@ public class PackageParser { int revisionCode, int installLocation, List<VerifierInfo> verifiers, SigningDetails signingDetails, boolean coreApp, boolean debuggable, boolean multiArch, boolean use32bitAbi, - boolean preferCodeIntegrity, boolean extractNativeLibs, boolean isolatedSplits) { + boolean useEmbeddedDex, boolean extractNativeLibs, boolean isolatedSplits) { this.codePath = codePath; this.packageName = packageName; this.splitName = splitName; @@ -501,7 +501,7 @@ public class PackageParser { this.debuggable = debuggable; this.multiArch = multiArch; this.use32bitAbi = use32bitAbi; - this.preferCodeIntegrity = preferCodeIntegrity; + this.useEmbeddedDex = useEmbeddedDex; this.extractNativeLibs = extractNativeLibs; this.isolatedSplits = isolatedSplits; this.isSplitRequired = isSplitRequired; @@ -1726,7 +1726,7 @@ public class PackageParser { boolean isolatedSplits = false; boolean isFeatureSplit = false; boolean isSplitRequired = false; - boolean preferCodeIntegrity = false; + boolean useEmbeddedDex = false; String configForSplit = null; String usesSplitName = null; @@ -1790,8 +1790,8 @@ public class PackageParser { extractNativeLibsProvided = Boolean.valueOf( attrs.getAttributeBooleanValue(i, true)); } - if ("preferCodeIntegrity".equals(attr)) { - preferCodeIntegrity = attrs.getAttributeBooleanValue(i, false); + if ("useEmbeddedDex".equals(attr)) { + useEmbeddedDex = attrs.getAttributeBooleanValue(i, false); } } } else if (TAG_USES_SPLIT.equals(parser.getName())) { @@ -1851,16 +1851,10 @@ public class PackageParser { final boolean extractNativeLibs = (extractNativeLibsProvided != null) ? extractNativeLibsProvided : extractNativeLibsDefault; - if (preferCodeIntegrity && extractNativeLibs) { - throw new PackageParserException( - PackageManager.INSTALL_PARSE_FAILED_MANIFEST_MALFORMED, - "Can't request both preferCodeIntegrity and extractNativeLibs"); - } - return new ApkLite(codePath, packageSplit.first, packageSplit.second, isFeatureSplit, configForSplit, usesSplitName, isSplitRequired, versionCode, versionCodeMajor, revisionCode, installLocation, verifiers, signingDetails, coreApp, debuggable, - multiArch, use32bitAbi, preferCodeIntegrity, extractNativeLibs, isolatedSplits); + multiArch, use32bitAbi, useEmbeddedDex, extractNativeLibs, isolatedSplits); } /** @@ -3789,9 +3783,9 @@ public class PackageParser { } if (sa.getBoolean( - R.styleable.AndroidManifestApplication_preferCodeIntegrity, + R.styleable.AndroidManifestApplication_useEmbeddedDex, false)) { - ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_PREFER_CODE_INTEGRITY; + ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_USE_EMBEDDED_DEX; } if (sa.getBoolean( diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java index 6061cb2963eb..6a290b7fe045 100644 --- a/core/java/android/view/LayoutInflater.java +++ b/core/java/android/view/LayoutInflater.java @@ -414,8 +414,7 @@ public abstract class LayoutInflater { // Make sure the application allows code generation ApplicationInfo appInfo = mContext.getApplicationInfo(); - if ((appInfo.privateFlags & ApplicationInfo.PRIVATE_FLAG_PREFER_CODE_INTEGRITY) != 0 - || appInfo.isPrivilegedApp()) { + if (appInfo.isEmbeddedDexUsed() || appInfo.isPrivilegedApp()) { mUseCompiledView = false; return; } |
