Rename preferCodeIntegrity to useEmbeddedDex
Also remove the restriction of extractNativeLibs.
Test: build, (new) CTS in progress
Bug: 112037137
Change-Id: If0ad13b0d63b288c2da3a82b911d8dad0db8c07a
diff --git a/services/core/java/com/android/server/pm/PackageDexOptimizer.java b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
index 94b1b36..5b38208 100644
--- a/services/core/java/com/android/server/pm/PackageDexOptimizer.java
+++ b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
@@ -507,7 +507,7 @@
int flags = info.flags;
boolean vmSafeMode = (flags & ApplicationInfo.FLAG_VM_SAFE_MODE) != 0;
// When an app or priv app is configured to run out of box, only verify it.
- if (info.isCodeIntegrityPreferred()
+ if (info.isEmbeddedDexUsed()
|| (info.isPrivilegedApp()
&& DexManager.isPackageSelectedToRunOob(info.packageName))) {
return "verify";
diff --git a/services/core/java/com/android/server/pm/PackageInstallerSession.java b/services/core/java/com/android/server/pm/PackageInstallerSession.java
index 494ec3f..9cda889a 100644
--- a/services/core/java/com/android/server/pm/PackageInstallerSession.java
+++ b/services/core/java/com/android/server/pm/PackageInstallerSession.java
@@ -1562,12 +1562,12 @@
}
}
}
- if (baseApk.preferCodeIntegrity) {
+ if (baseApk.useEmbeddedDex) {
for (File file : mResolvedStagedFiles) {
if (file.getName().endsWith(".apk")
- && !DexManager.auditUncompressedCodeInApk(file.getPath())) {
+ && !DexManager.auditUncompressedDexInApk(file.getPath())) {
throw new PackageManagerException(INSTALL_FAILED_INVALID_APK,
- "Some code are not uncompressed and aligned correctly for "
+ "Some dex are not uncompressed and aligned correctly for "
+ mPackageName);
}
}
diff --git a/services/core/java/com/android/server/pm/dex/ArtManagerService.java b/services/core/java/com/android/server/pm/dex/ArtManagerService.java
index 7d2dd65..23705db 100644
--- a/services/core/java/com/android/server/pm/dex/ArtManagerService.java
+++ b/services/core/java/com/android/server/pm/dex/ArtManagerService.java
@@ -480,7 +480,7 @@
final String apkPath = pkg.baseCodePath;
final ApplicationInfo appInfo = pkg.applicationInfo;
final String outDexFile = appInfo.dataDir + "/code_cache/compiled_view.dex";
- if (appInfo.isPrivilegedApp() || appInfo.isCodeIntegrityPreferred()) {
+ if (appInfo.isPrivilegedApp() || appInfo.isEmbeddedDexUsed()) {
// Privileged apps prefer to load trusted code so they don't use compiled views.
// If the app is not privileged but prefers code integrity, also avoid compiling
// views.
diff --git a/services/core/java/com/android/server/pm/dex/DexManager.java b/services/core/java/com/android/server/pm/dex/DexManager.java
index 7ac7395..b9d388b 100644
--- a/services/core/java/com/android/server/pm/dex/DexManager.java
+++ b/services/core/java/com/android/server/pm/dex/DexManager.java
@@ -740,10 +740,10 @@
}
/**
- * Generates log if the archive located at {@code fileName} has uncompressed dex file and so
- * files that can be direclty mapped.
+ * Generates log if the archive located at {@code fileName} has uncompressed dex file that can
+ * be direclty mapped.
*/
- public static boolean auditUncompressedCodeInApk(String fileName) {
+ public static boolean auditUncompressedDexInApk(String fileName) {
StrictJarFile jarFile = null;
try {
jarFile = new StrictJarFile(fileName,
@@ -762,16 +762,6 @@
Slog.w(TAG, "APK " + fileName + " has unaligned dex code " +
entry.getName());
}
- } else if (entry.getName().endsWith(".so")) {
- if (entry.getMethod() != ZipEntry.STORED) {
- allCorrect = false;
- Slog.w(TAG, "APK " + fileName + " has compressed native code " +
- entry.getName());
- } else if ((entry.getDataOffset() & (0x1000 - 1)) != 0) {
- allCorrect = false;
- Slog.w(TAG, "APK " + fileName + " has unaligned native code " +
- entry.getName());
- }
}
}
return allCorrect;