Remove unused flag DEXOPT_ONLY_SHARED_DEX.
It's not set anywhere except in tests. History shows it was implemented
in ce543973 and partially reverted in 1ba0b8ac. However a flag
refactoring in 1d0e83d2 got in between, so some parts of the flag
handling code wasn't cleaned up in the revert.
The flag is removed keep parity with ART Services, where it is not
(currently) planned to be supported.
Test: atest DexoptOptionsTests
Bug: 251903639
Change-Id: I09b3eb09636c2add529e1c77e938e073d634fe50
diff --git a/services/core/java/com/android/server/pm/PackageDexOptimizer.java b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
index d25bca7..2a2410fd 100644
--- a/services/core/java/com/android/server/pm/PackageDexOptimizer.java
+++ b/services/core/java/com/android/server/pm/PackageDexOptimizer.java
@@ -652,12 +652,6 @@
@DexOptResult
private int dexOptSecondaryDexPathLI(ApplicationInfo info, String path,
PackageDexUsage.DexUseInfo dexUseInfo, DexoptOptions options) {
- if (options.isDexoptOnlySharedDex() && !dexUseInfo.isUsedByOtherApps()) {
- // We are asked to optimize only the dex files used by other apps and this is not
- // on of them: skip it.
- return DEX_OPT_SKIPPED;
- }
-
String compilerFilter = getRealCompilerFilter(info, options.getCompilerFilter(),
dexUseInfo.isUsedByOtherApps());
// Get the dexopt flags after getRealCompilerFilter to make sure we get the correct flags.
diff --git a/services/core/java/com/android/server/pm/dex/DexoptOptions.java b/services/core/java/com/android/server/pm/dex/DexoptOptions.java
index ea23316..13f6ee7 100644
--- a/services/core/java/com/android/server/pm/dex/DexoptOptions.java
+++ b/services/core/java/com/android/server/pm/dex/DexoptOptions.java
@@ -40,10 +40,6 @@
// will only consider the primary apk.
public static final int DEXOPT_ONLY_SECONDARY_DEX = 1 << 3;
- // When set, dexopt will optimize only dex files that are used by other apps.
- // Currently, this flag is ignored for primary apks.
- public static final int DEXOPT_ONLY_SHARED_DEX = 1 << 4;
-
// When set, dexopt will attempt to scale down the optimizations previously applied in order
// save disk space.
public static final int DEXOPT_DOWNGRADE = 1 << 5;
@@ -105,7 +101,6 @@
DEXOPT_FORCE |
DEXOPT_BOOT_COMPLETE |
DEXOPT_ONLY_SECONDARY_DEX |
- DEXOPT_ONLY_SHARED_DEX |
DEXOPT_DOWNGRADE |
DEXOPT_AS_SHARED_LIBRARY |
DEXOPT_IDLE_BACKGROUND_JOB |
@@ -146,10 +141,6 @@
return (mFlags & DEXOPT_ONLY_SECONDARY_DEX) != 0;
}
- public boolean isDexoptOnlySharedDex() {
- return (mFlags & DEXOPT_ONLY_SHARED_DEX) != 0;
- }
-
public boolean isDowngrade() {
return (mFlags & DEXOPT_DOWNGRADE) != 0;
}
diff --git a/services/tests/servicestests/src/com/android/server/pm/dex/DexoptOptionsTests.java b/services/tests/servicestests/src/com/android/server/pm/dex/DexoptOptionsTests.java
index d5893c8..77d542a 100644
--- a/services/tests/servicestests/src/com/android/server/pm/dex/DexoptOptionsTests.java
+++ b/services/tests/servicestests/src/com/android/server/pm/dex/DexoptOptionsTests.java
@@ -52,7 +52,6 @@
assertFalse(opt.isBootComplete());
assertFalse(opt.isCheckForProfileUpdates());
assertFalse(opt.isDexoptOnlySecondaryDex());
- assertFalse(opt.isDexoptOnlySharedDex());
assertFalse(opt.isDowngrade());
assertFalse(opt.isForce());
assertFalse(opt.isDexoptIdleBackgroundJob());
@@ -67,7 +66,6 @@
DexoptOptions.DEXOPT_BOOT_COMPLETE |
DexoptOptions.DEXOPT_CHECK_FOR_PROFILES_UPDATES |
DexoptOptions.DEXOPT_ONLY_SECONDARY_DEX |
- DexoptOptions.DEXOPT_ONLY_SHARED_DEX |
DexoptOptions.DEXOPT_DOWNGRADE |
DexoptOptions.DEXOPT_AS_SHARED_LIBRARY |
DexoptOptions.DEXOPT_IDLE_BACKGROUND_JOB |
@@ -81,7 +79,6 @@
assertTrue(opt.isBootComplete());
assertTrue(opt.isCheckForProfileUpdates());
assertTrue(opt.isDexoptOnlySecondaryDex());
- assertTrue(opt.isDexoptOnlySharedDex());
assertTrue(opt.isDowngrade());
assertTrue(opt.isForce());
assertTrue(opt.isDexoptAsSharedLibrary());
@@ -113,7 +110,6 @@
assertTrue(opt.isBootComplete());
assertTrue(opt.isCheckForProfileUpdates());
assertFalse(opt.isDexoptOnlySecondaryDex());
- assertFalse(opt.isDexoptOnlySharedDex());
assertFalse(opt.isDowngrade());
assertTrue(opt.isForce());
assertFalse(opt.isDexoptAsSharedLibrary());
@@ -131,7 +127,6 @@
assertTrue(opt.isBootComplete());
assertFalse(opt.isCheckForProfileUpdates());
assertFalse(opt.isDexoptOnlySecondaryDex());
- assertFalse(opt.isDexoptOnlySharedDex());
assertFalse(opt.isDowngrade());
assertTrue(opt.isForce());
assertFalse(opt.isDexoptAsSharedLibrary());