From 280ea1af03eb6f61925e3556372c40eb0e6edfe3 Mon Sep 17 00:00:00 2001 From: Martin Stjernholm Date: Tue, 18 Oct 2022 13:48:22 +0100 Subject: [PATCH] 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 --- .../java/com/android/server/pm/PackageDexOptimizer.java | 6 ------ .../java/com/android/server/pm/dex/DexoptOptions.java | 9 --------- .../com/android/server/pm/dex/DexoptOptionsTests.java | 5 ----- 3 files changed, 20 deletions(-) diff --git a/services/core/java/com/android/server/pm/PackageDexOptimizer.java b/services/core/java/com/android/server/pm/PackageDexOptimizer.java index d25bca76245bf..2a2410fd17679 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 @@ public class PackageDexOptimizer { @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 ea233161b4afb..13f6ee77aacec 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 @@ public final class DexoptOptions { // 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 @@ public final class DexoptOptions { 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 @@ public final class DexoptOptions { 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 d5893c8d0b9fe..77d542a2e43dd 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 @@ public class DexoptOptionsTests { 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 @@ public class DexoptOptionsTests { 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 @@ public class DexoptOptionsTests { 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 @@ public class DexoptOptionsTests { 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 @@ public class DexoptOptionsTests { assertTrue(opt.isBootComplete()); assertFalse(opt.isCheckForProfileUpdates()); assertFalse(opt.isDexoptOnlySecondaryDex()); - assertFalse(opt.isDexoptOnlySharedDex()); assertFalse(opt.isDowngrade()); assertTrue(opt.isForce()); assertFalse(opt.isDexoptAsSharedLibrary());