Loading core/java/android/provider/DeviceConfig.java +7 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,13 @@ public final class DeviceConfig { @SystemApi public static final String NAMESPACE_ACTIVITY_MANAGER = "activity_manager"; /** * Namespace for activity manager, specific to the "component alias" feature. We needed a * different namespace in order to avoid phonetype from resetting it. * @hide */ public static final String NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS = "activity_manager_ca"; /** * Namespace for all activity manager related features that are used at the native level. * These features are applied at reboot. Loading services/core/java/com/android/server/am/ActivityManagerConstants.java +37 −6 Original line number Diff line number Diff line Loading @@ -127,7 +127,15 @@ final class ActivityManagerConstants extends ContentObserver { static final String KEY_KILL_BG_RESTRICTED_CACHED_IDLE = "kill_bg_restricted_cached_idle"; static final String KEY_KILL_BG_RESTRICTED_CACHED_IDLE_SETTLE_TIME = "kill_bg_restricted_cached_idle_settle_time"; /** * Note this key is on {@link DeviceConfig#NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS}. * @see #mEnableComponentAlias */ static final String KEY_ENABLE_COMPONENT_ALIAS = "enable_experimental_component_alias"; /** * Note this key is on {@link DeviceConfig#NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS}. * @see #mComponentAliasOverrides */ static final String KEY_COMPONENT_ALIAS_OVERRIDES = "component_alias_overrides"; private static final int DEFAULT_MAX_CACHED_PROCESSES = 32; Loading Loading @@ -899,10 +907,6 @@ final class ActivityManagerConstants extends ContentObserver { case KEY_ENABLE_EXTRA_SERVICE_RESTART_DELAY_ON_MEM_PRESSURE: updateEnableExtraServiceRestartDelayOnMemPressure(); break; case KEY_ENABLE_COMPONENT_ALIAS: case KEY_COMPONENT_ALIAS_OVERRIDES: updateComponentAliases(); break; case KEY_PROCESS_KILL_TIMEOUT: updateProcessKillTimeout(); break; Loading @@ -925,6 +929,26 @@ final class ActivityManagerConstants extends ContentObserver { } }; private final OnPropertiesChangedListener mOnDeviceConfigChangedForComponentAliasListener = new OnPropertiesChangedListener() { @Override public void onPropertiesChanged(Properties properties) { for (String name : properties.getKeyset()) { if (name == null) { return; } switch (name) { case KEY_ENABLE_COMPONENT_ALIAS: case KEY_COMPONENT_ALIAS_OVERRIDES: updateComponentAliases(); break; default: break; } } } }; ActivityManagerConstants(Context context, ActivityManagerService service, Handler handler) { super(handler); mService = service; Loading Loading @@ -991,6 +1015,10 @@ final class ActivityManagerConstants extends ContentObserver { DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, ActivityThread.currentApplication().getMainExecutor(), mOnDeviceConfigChangedListener); DeviceConfig.addOnPropertiesChangedListener( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS, ActivityThread.currentApplication().getMainExecutor(), mOnDeviceConfigChangedForComponentAliasListener); loadDeviceConfigConstants(); // The following read from Settings. updateActivityStartsLoggingEnabled(); Loading @@ -1000,6 +1028,9 @@ final class ActivityManagerConstants extends ContentObserver { private void loadDeviceConfigConstants() { mOnDeviceConfigChangedListener.onPropertiesChanged( DeviceConfig.getProperties(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER)); mOnDeviceConfigChangedForComponentAliasListener.onPropertiesChanged( DeviceConfig.getProperties( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS)); } public void setOverrideMaxCachedProcesses(int value) { Loading Loading @@ -1379,11 +1410,11 @@ final class ActivityManagerConstants extends ContentObserver { private void updateComponentAliases() { mEnableComponentAlias = DeviceConfig.getBoolean( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS, KEY_ENABLE_COMPONENT_ALIAS, DEFAULT_ENABLE_COMPONENT_ALIAS); mComponentAliasOverrides = DeviceConfig.getString( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS, KEY_COMPONENT_ALIAS_OVERRIDES, DEFAULT_COMPONENT_ALIAS_OVERRIDES); mService.mComponentAliasResolver.update(mEnableComponentAlias, mComponentAliasOverrides); Loading tests/componentalias/src/android/content/componentalias/tests/BaseComponentAliasTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ public class BaseComponentAliasTest { protected static final Context sContext = InstrumentationRegistry.getTargetContext(); protected static final DeviceConfigStateHelper sDeviceConfig = new DeviceConfigStateHelper( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER); DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS); @Before public void enableComponentAliasWithCompatFlag() throws Exception { Assume.assumeTrue(Build.isDebuggable()); Loading tests/componentalias/src/android/content/componentalias/tests/ComponentAliasEnableWithDeviceConfigTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import org.junit.Test; public class ComponentAliasEnableWithDeviceConfigTest { protected static final DeviceConfigStateHelper sDeviceConfig = new DeviceConfigStateHelper( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER); DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS); @AfterClass public static void restoreDeviceConfig() throws Exception { Loading tests/componentalias/src/android/content/componentalias/tests/ComponentAliasNotSupportedOnUserBuildTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ import org.junit.Test; */ public class ComponentAliasNotSupportedOnUserBuildTest { protected static final DeviceConfigStateHelper sDeviceConfig = new DeviceConfigStateHelper( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER); DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS); @AfterClass public static void restoreDeviceConfig() throws Exception { Loading Loading
core/java/android/provider/DeviceConfig.java +7 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,13 @@ public final class DeviceConfig { @SystemApi public static final String NAMESPACE_ACTIVITY_MANAGER = "activity_manager"; /** * Namespace for activity manager, specific to the "component alias" feature. We needed a * different namespace in order to avoid phonetype from resetting it. * @hide */ public static final String NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS = "activity_manager_ca"; /** * Namespace for all activity manager related features that are used at the native level. * These features are applied at reboot. Loading
services/core/java/com/android/server/am/ActivityManagerConstants.java +37 −6 Original line number Diff line number Diff line Loading @@ -127,7 +127,15 @@ final class ActivityManagerConstants extends ContentObserver { static final String KEY_KILL_BG_RESTRICTED_CACHED_IDLE = "kill_bg_restricted_cached_idle"; static final String KEY_KILL_BG_RESTRICTED_CACHED_IDLE_SETTLE_TIME = "kill_bg_restricted_cached_idle_settle_time"; /** * Note this key is on {@link DeviceConfig#NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS}. * @see #mEnableComponentAlias */ static final String KEY_ENABLE_COMPONENT_ALIAS = "enable_experimental_component_alias"; /** * Note this key is on {@link DeviceConfig#NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS}. * @see #mComponentAliasOverrides */ static final String KEY_COMPONENT_ALIAS_OVERRIDES = "component_alias_overrides"; private static final int DEFAULT_MAX_CACHED_PROCESSES = 32; Loading Loading @@ -899,10 +907,6 @@ final class ActivityManagerConstants extends ContentObserver { case KEY_ENABLE_EXTRA_SERVICE_RESTART_DELAY_ON_MEM_PRESSURE: updateEnableExtraServiceRestartDelayOnMemPressure(); break; case KEY_ENABLE_COMPONENT_ALIAS: case KEY_COMPONENT_ALIAS_OVERRIDES: updateComponentAliases(); break; case KEY_PROCESS_KILL_TIMEOUT: updateProcessKillTimeout(); break; Loading @@ -925,6 +929,26 @@ final class ActivityManagerConstants extends ContentObserver { } }; private final OnPropertiesChangedListener mOnDeviceConfigChangedForComponentAliasListener = new OnPropertiesChangedListener() { @Override public void onPropertiesChanged(Properties properties) { for (String name : properties.getKeyset()) { if (name == null) { return; } switch (name) { case KEY_ENABLE_COMPONENT_ALIAS: case KEY_COMPONENT_ALIAS_OVERRIDES: updateComponentAliases(); break; default: break; } } } }; ActivityManagerConstants(Context context, ActivityManagerService service, Handler handler) { super(handler); mService = service; Loading Loading @@ -991,6 +1015,10 @@ final class ActivityManagerConstants extends ContentObserver { DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, ActivityThread.currentApplication().getMainExecutor(), mOnDeviceConfigChangedListener); DeviceConfig.addOnPropertiesChangedListener( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS, ActivityThread.currentApplication().getMainExecutor(), mOnDeviceConfigChangedForComponentAliasListener); loadDeviceConfigConstants(); // The following read from Settings. updateActivityStartsLoggingEnabled(); Loading @@ -1000,6 +1028,9 @@ final class ActivityManagerConstants extends ContentObserver { private void loadDeviceConfigConstants() { mOnDeviceConfigChangedListener.onPropertiesChanged( DeviceConfig.getProperties(DeviceConfig.NAMESPACE_ACTIVITY_MANAGER)); mOnDeviceConfigChangedForComponentAliasListener.onPropertiesChanged( DeviceConfig.getProperties( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS)); } public void setOverrideMaxCachedProcesses(int value) { Loading Loading @@ -1379,11 +1410,11 @@ final class ActivityManagerConstants extends ContentObserver { private void updateComponentAliases() { mEnableComponentAlias = DeviceConfig.getBoolean( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS, KEY_ENABLE_COMPONENT_ALIAS, DEFAULT_ENABLE_COMPONENT_ALIAS); mComponentAliasOverrides = DeviceConfig.getString( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER, DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS, KEY_COMPONENT_ALIAS_OVERRIDES, DEFAULT_COMPONENT_ALIAS_OVERRIDES); mService.mComponentAliasResolver.update(mEnableComponentAlias, mComponentAliasOverrides); Loading
tests/componentalias/src/android/content/componentalias/tests/BaseComponentAliasTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -37,7 +37,7 @@ public class BaseComponentAliasTest { protected static final Context sContext = InstrumentationRegistry.getTargetContext(); protected static final DeviceConfigStateHelper sDeviceConfig = new DeviceConfigStateHelper( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER); DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS); @Before public void enableComponentAliasWithCompatFlag() throws Exception { Assume.assumeTrue(Build.isDebuggable()); Loading
tests/componentalias/src/android/content/componentalias/tests/ComponentAliasEnableWithDeviceConfigTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ import org.junit.Test; public class ComponentAliasEnableWithDeviceConfigTest { protected static final DeviceConfigStateHelper sDeviceConfig = new DeviceConfigStateHelper( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER); DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS); @AfterClass public static void restoreDeviceConfig() throws Exception { Loading
tests/componentalias/src/android/content/componentalias/tests/ComponentAliasNotSupportedOnUserBuildTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -32,7 +32,7 @@ import org.junit.Test; */ public class ComponentAliasNotSupportedOnUserBuildTest { protected static final DeviceConfigStateHelper sDeviceConfig = new DeviceConfigStateHelper( DeviceConfig.NAMESPACE_ACTIVITY_MANAGER); DeviceConfig.NAMESPACE_ACTIVITY_MANAGER_COMPONENT_ALIAS); @AfterClass public static void restoreDeviceConfig() throws Exception { Loading