diff options
5 files changed, 25 insertions, 64 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index 22da4d6b9916..96abf64cd83a 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5888,7 +5888,7 @@ package android.provider { field public static final String NAMESPACE_AUTOFILL = "autofill"; field public static final String NAMESPACE_CONNECTIVITY = "connectivity"; field public static final String NAMESPACE_CONTENT_CAPTURE = "content_capture"; - field public static final String NAMESPACE_DEX_BOOT = "dex_boot"; + field @Deprecated public static final String NAMESPACE_DEX_BOOT = "dex_boot"; field public static final String NAMESPACE_DISPLAY_MANAGER = "display_manager"; field public static final String NAMESPACE_GAME_DRIVER = "game_driver"; field public static final String NAMESPACE_INPUT_NATIVE_BOOT = "input_native_boot"; diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java index e456c8a42e19..b004214c8c0b 100644 --- a/core/java/android/provider/DeviceConfig.java +++ b/core/java/android/provider/DeviceConfig.java @@ -130,8 +130,10 @@ public final class DeviceConfig { /** * Namespace for how dex runs. The feature requires a reboot to reach a clean state. * + * @deprecated No longer used * @hide */ + @Deprecated @SystemApi public static final String NAMESPACE_DEX_BOOT = "dex_boot"; diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java index 2ce4e9771d7c..4aebbb99b596 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java @@ -56,8 +56,6 @@ class SettingsProtoDumpUtil { ConfigSettingsProto.CONNECTIVITY_SETTINGS); namespaceToFieldMap.put(DeviceConfig.NAMESPACE_CONTENT_CAPTURE, ConfigSettingsProto.CONTENT_CAPTURE_SETTINGS); - namespaceToFieldMap.put(DeviceConfig.NAMESPACE_DEX_BOOT, - ConfigSettingsProto.DEX_BOOT_SETTINGS); namespaceToFieldMap.put(DeviceConfig.NAMESPACE_GAME_DRIVER, ConfigSettingsProto.GAME_DRIVER_SETTINGS); namespaceToFieldMap.put(DeviceConfig.NAMESPACE_INPUT_NATIVE_BOOT, 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 f56231fc02af..41dcaa59047b 100644 --- a/services/core/java/com/android/server/pm/dex/DexManager.java +++ b/services/core/java/com/android/server/pm/dex/DexManager.java @@ -16,8 +16,6 @@ package com.android.server.pm.dex; -import static android.provider.DeviceConfig.NAMESPACE_DEX_BOOT; - import static com.android.server.pm.InstructionSets.getAppDexInstructionSets; import static com.android.server.pm.dex.PackageDexUsage.DexUseInfo; import static com.android.server.pm.dex.PackageDexUsage.PackageUseInfo; @@ -31,7 +29,6 @@ import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; import android.os.storage.StorageManager; -import android.provider.DeviceConfig; import android.util.Log; import android.util.Slog; import android.util.jar.StrictJarFile; @@ -72,10 +69,6 @@ public class DexManager { private static final String PROPERTY_NAME_PM_DEXOPT_PRIV_APPS_OOB_LIST = "pm.dexopt.priv-apps-oob-list"; - // flags for Device Config API - private static final String PRIV_APPS_OOB_ENABLED = "priv_apps_oob_enabled"; - private static final String PRIV_APPS_OOB_WHITELIST = "priv_apps_oob_whitelist"; - private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); private final Context mContext; @@ -717,24 +710,16 @@ public class DexManager { return isPackageSelectedToRunOobInternal( SystemProperties.getBoolean(PROPERTY_NAME_PM_DEXOPT_PRIV_APPS_OOB, false), SystemProperties.get(PROPERTY_NAME_PM_DEXOPT_PRIV_APPS_OOB_LIST, "ALL"), - DeviceConfig.getProperty(NAMESPACE_DEX_BOOT, PRIV_APPS_OOB_ENABLED), - DeviceConfig.getProperty(NAMESPACE_DEX_BOOT, PRIV_APPS_OOB_WHITELIST), packageNamesInSameProcess); } @VisibleForTesting - /* package */ static boolean isPackageSelectedToRunOobInternal( - boolean isDefaultEnabled, String defaultWhitelist, String overrideEnabled, - String overrideWhitelist, Collection<String> packageNamesInSameProcess) { - // Allow experiment (if exists) to override device configuration. - boolean enabled = overrideEnabled != null ? overrideEnabled.equals("true") - : isDefaultEnabled; - if (!enabled) { + /* package */ static boolean isPackageSelectedToRunOobInternal(boolean isEnabled, + String whitelist, Collection<String> packageNamesInSameProcess) { + if (!isEnabled) { return false; } - // Similarly, experiment flag can override the whitelist. - String whitelist = overrideWhitelist != null ? overrideWhitelist : defaultWhitelist; if ("ALL".equals(whitelist)) { return true; } diff --git a/services/tests/servicestests/src/com/android/server/pm/dex/DexManagerTests.java b/services/tests/servicestests/src/com/android/server/pm/dex/DexManagerTests.java index 0196279cbf56..f08044c0b5b5 100644 --- a/services/tests/servicestests/src/com/android/server/pm/dex/DexManagerTests.java +++ b/services/tests/servicestests/src/com/android/server/pm/dex/DexManagerTests.java @@ -691,35 +691,16 @@ public class DexManagerTests { } } - private boolean shouldPackageRunOob( - boolean isDefaultEnabled, String defaultWhitelist, String overrideEnabled, - String overrideWhitelist, Collection<String> packageNamesInSameProcess) { + private boolean shouldPackageRunOob(boolean isDefaultEnabled, String whitelist, + Collection<String> packageNamesInSameProcess) { return DexManager.isPackageSelectedToRunOobInternal( - isDefaultEnabled, defaultWhitelist, overrideEnabled, overrideWhitelist, - packageNamesInSameProcess); + isDefaultEnabled, whitelist, packageNamesInSameProcess); } @Test - public void testOobPackageSelectionSwitch() { + public void testOobPackageSelectionDefault() { // Feature is off by default, not overriden - assertFalse(shouldPackageRunOob(false, "ALL", null, null, null)); - - // Feature is off by default, overriden - assertTrue(shouldPackageRunOob(false, "ALL", "true", "ALL", null)); - assertFalse(shouldPackageRunOob(false, "ALL", "false", null, null)); - assertFalse(shouldPackageRunOob(false, "ALL", "false", "ALL", null)); - assertFalse(shouldPackageRunOob(false, "ALL", "false", null, null)); - - // Feature is on by default, not overriden - assertTrue(shouldPackageRunOob(true, "ALL", null, null, null)); - assertTrue(shouldPackageRunOob(true, "ALL", null, null, null)); - assertTrue(shouldPackageRunOob(true, "ALL", null, "ALL", null)); - - // Feature is on by default, overriden - assertTrue(shouldPackageRunOob(true, "ALL", "true", null, null)); - assertTrue(shouldPackageRunOob(true, "ALL", "true", "ALL", null)); - assertFalse(shouldPackageRunOob(true, "ALL", "false", null, null)); - assertFalse(shouldPackageRunOob(true, "ALL", "false", "ALL", null)); + assertFalse(shouldPackageRunOob(false, "ALL", null)); } @Test @@ -734,24 +715,19 @@ public class DexManagerTests { final Collection<String> runningPackages = Arrays.asList("com.priv.app1", "com.priv.app2"); // Feature is off, whitelist does not matter - assertFalse(shouldPackageRunOob(false, kWhitelistApp0, null, null, runningPackages)); - assertFalse(shouldPackageRunOob(false, kWhitelistApp1, null, null, runningPackages)); - assertFalse(shouldPackageRunOob(false, "", null, kWhitelistApp1, runningPackages)); - assertFalse(shouldPackageRunOob(false, "", null, "ALL", runningPackages)); - assertFalse(shouldPackageRunOob(false, "ALL", null, "ALL", runningPackages)); - assertFalse(shouldPackageRunOob(false, "ALL", null, "", runningPackages)); - - // Feature is on, app not in default or overridden whitelist - assertFalse(shouldPackageRunOob(true, kWhitelistApp0, null, null, runningPackages)); - assertFalse(shouldPackageRunOob(true, "", null, kWhitelistApp0, runningPackages)); - assertFalse(shouldPackageRunOob(true, "ALL", null, kWhitelistApp0, runningPackages)); - - // Feature is on, app in default or overridden whitelist - assertTrue(shouldPackageRunOob(true, kWhitelistApp1, null, null, runningPackages)); - assertTrue(shouldPackageRunOob(true, kWhitelistApp2, null, null, runningPackages)); - assertTrue(shouldPackageRunOob(true, kWhitelistApp1AndApp2, null, null, runningPackages)); - assertTrue(shouldPackageRunOob(true, kWhitelistApp1, null, "ALL", runningPackages)); - assertTrue(shouldPackageRunOob(true, "", null, kWhitelistApp1, runningPackages)); - assertTrue(shouldPackageRunOob(true, "ALL", null, kWhitelistApp1, runningPackages)); + assertFalse(shouldPackageRunOob(false, kWhitelistApp0, runningPackages)); + assertFalse(shouldPackageRunOob(false, kWhitelistApp1, runningPackages)); + assertFalse(shouldPackageRunOob(false, "", runningPackages)); + assertFalse(shouldPackageRunOob(false, "ALL", runningPackages)); + + // Feature is on, app not in whitelist + assertFalse(shouldPackageRunOob(true, kWhitelistApp0, runningPackages)); + assertFalse(shouldPackageRunOob(true, "", runningPackages)); + + // Feature is on, app in whitelist + assertTrue(shouldPackageRunOob(true, kWhitelistApp1, runningPackages)); + assertTrue(shouldPackageRunOob(true, kWhitelistApp2, runningPackages)); + assertTrue(shouldPackageRunOob(true, kWhitelistApp1AndApp2, runningPackages)); + assertTrue(shouldPackageRunOob(true, "ALL", runningPackages)); } } |