Loading core/java/android/hardware/display/AmbientDisplayConfiguration.java +19 −3 Original line number Diff line number Diff line Loading @@ -45,6 +45,9 @@ public class AmbientDisplayConfiguration { private final boolean mAlwaysOnByDefault; private final boolean mPickupGestureEnabledByDefault; private final boolean mScreenOffUdfpsAvailable; private final boolean mDozeEnabledByDefault; private final boolean mTapGestureEnabledByDefault; private final boolean mDoubleTapGestureEnabledByDefault; /** Copied from android.provider.Settings.Secure since these keys are hidden. */ private static final String[] DOZE_SETTINGS = { Loading Loading @@ -74,6 +77,16 @@ public class AmbientDisplayConfiguration { mContext.getResources().getBoolean(R.bool.config_dozePickupGestureEnabled); mScreenOffUdfpsAvailable = mContext.getResources().getBoolean(R.bool.config_screen_off_udfps_enabled); mDozeEnabledByDefault = !com.android.server.display.feature.flags.Flags.configurableDefaultDozeValues() || mContext.getResources().getBoolean(R.bool.config_dozeEnabled); mTapGestureEnabledByDefault = !com.android.server.display.feature.flags.Flags.configurableDefaultDozeValues() || mContext.getResources().getBoolean(R.bool.config_dozeTapGestureEnabled); mDoubleTapGestureEnabledByDefault = !com.android.server.display.feature.flags.Flags.configurableDefaultDozeValues() || mContext.getResources().getBoolean( R.bool.config_dozeDoubleTapGestureEnabled); } /** @hide */ Loading @@ -92,7 +105,8 @@ public class AmbientDisplayConfiguration { /** @hide */ public boolean pulseOnNotificationEnabled(int user) { return boolSettingDefaultOn(Settings.Secure.DOZE_ENABLED, user) return boolSetting(Settings.Secure.DOZE_ENABLED, user, mDozeEnabledByDefault ? 1 : 0) && pulseOnNotificationAvailable(); } Loading @@ -116,7 +130,8 @@ public class AmbientDisplayConfiguration { /** @hide */ public boolean tapGestureEnabled(int user) { return boolSettingDefaultOn(Settings.Secure.DOZE_TAP_SCREEN_GESTURE, user) return boolSetting(Settings.Secure.DOZE_TAP_SCREEN_GESTURE, user, mTapGestureEnabledByDefault ? 1 : 0) && tapSensorAvailable(); } Loading @@ -132,7 +147,8 @@ public class AmbientDisplayConfiguration { /** @hide */ public boolean doubleTapGestureEnabled(int user) { return boolSettingDefaultOn(Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, user) return boolSetting(Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, user, mDoubleTapGestureEnabledByDefault ? 1 : 0) && doubleTapSensorAvailable(); } Loading core/res/res/values/config.xml +12 −0 Original line number Diff line number Diff line Loading @@ -2964,6 +2964,18 @@ during initialization when the setting is still null. --> <bool name="config_dozePickupGestureEnabled">true</bool> <!-- Control whether doze is enabled by default. This value will be used during initialization when the setting is still null. --> <bool name="config_dozeEnabled">true</bool> <!-- Control whether the single tap gesture is enabled by default. This value will be used during initialization when the setting is still null. --> <bool name="config_dozeTapGestureEnabled">true</bool> <!-- Control whether the double tap gesture is enabled by default. This value will be used during initialization when the setting is still null. --> <bool name="config_dozeDoubleTapGestureEnabled">true</bool> <!-- Control whether the always on display mode is enabled by default. This value will be used during initialization when the setting is still null. --> <bool name="config_dozeAlwaysOnEnabled">true</bool> Loading core/res/res/values/symbols.xml +3 −0 Original line number Diff line number Diff line Loading @@ -4248,6 +4248,9 @@ <java-symbol type="integer" name="config_autoGroupAtCount" /> <java-symbol type="bool" name="config_dozeAlwaysOnDisplayAvailable" /> <java-symbol type="bool" name="config_dozePickupGestureEnabled" /> <java-symbol type="bool" name="config_dozeEnabled" /> <java-symbol type="bool" name="config_dozeTapGestureEnabled" /> <java-symbol type="bool" name="config_dozeDoubleTapGestureEnabled" /> <java-symbol type="bool" name="config_dozeAlwaysOnEnabled" /> <java-symbol type="bool" name="config_dozeSupportsAodWallpaper" /> <java-symbol type="bool" name="config_displayBlanksAfterDoze" /> Loading packages/SystemUI/multivalentTests/src/com/android/systemui/doze/DozeConfigurationTest.java +66 −1 Original line number Diff line number Diff line Loading @@ -16,15 +16,20 @@ package com.android.systemui.doze; import static com.google.common.truth.Truth.assertThat; import static junit.framework.TestCase.assertEquals; import android.hardware.display.AmbientDisplayConfiguration; import android.os.UserHandle; import android.platform.test.annotations.EnableFlags; import android.provider.Settings; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.android.internal.R; import com.android.server.display.feature.flags.Flags; import com.android.systemui.SysuiTestCase; import org.junit.Before; Loading @@ -39,11 +44,19 @@ public class DozeConfigurationTest extends SysuiTestCase { @Before public void setup() { mContext.getOrCreateTestableResources().addOverride( R.bool.config_pulseOnNotificationsAvailable, true); mContext.getOrCreateTestableResources().addOverride(R.string.config_dozeComponent, "FakeDozeComponent"); mContext.getOrCreateTestableResources().addOverride( R.array.config_dozeTapSensorPostureMapping, new String[]{"posture1", "posture2"}); mContext.getOrCreateTestableResources().addOverride(R.string.config_dozeDoubleTapSensorType, "FakeDoubleTapSensorType"); mDozeConfig = new AmbientDisplayConfiguration(mContext); } @Test public void alwaysOn_followsConfigByDefault() throws Exception { public void alwaysOn_followsConfigByDefault() { if (!mDozeConfig.alwaysOnAvailable()) { return; } Loading @@ -54,4 +67,56 @@ public class DozeConfigurationTest extends SysuiTestCase { .getBoolean(com.android.internal.R.bool.config_dozeAlwaysOnEnabled); assertEquals(defaultValue, mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT)); } @Test @EnableFlags(Flags.FLAG_CONFIGURABLE_DEFAULT_DOZE_VALUES) public void pulseOnNotificationEnabledByDefault() { mContext.getOrCreateTestableResources().addOverride(R.bool.config_dozeEnabled, true); mDozeConfig = new AmbientDisplayConfiguration(mContext); assertThat(mDozeConfig.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)).isTrue(); } @Test @EnableFlags(Flags.FLAG_CONFIGURABLE_DEFAULT_DOZE_VALUES) public void pulseOnNotificationDisabledByDefault() { mContext.getOrCreateTestableResources().addOverride(R.bool.config_dozeEnabled, false); mDozeConfig = new AmbientDisplayConfiguration(mContext); assertThat(mDozeConfig.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)).isFalse(); } @Test @EnableFlags(Flags.FLAG_CONFIGURABLE_DEFAULT_DOZE_VALUES) public void tapGestureEnabledByDefault() { mContext.getOrCreateTestableResources().addOverride(R.bool.config_dozeTapGestureEnabled, true); mDozeConfig = new AmbientDisplayConfiguration(mContext); assertThat(mDozeConfig.tapGestureEnabled(UserHandle.USER_CURRENT)).isTrue(); } @Test @EnableFlags(Flags.FLAG_CONFIGURABLE_DEFAULT_DOZE_VALUES) public void tapGestureDisabledByDefault() { mContext.getOrCreateTestableResources().addOverride(R.bool.config_dozeTapGestureEnabled, false); mDozeConfig = new AmbientDisplayConfiguration(mContext); assertThat(mDozeConfig.tapGestureEnabled(UserHandle.USER_CURRENT)).isFalse(); } @Test @EnableFlags(Flags.FLAG_CONFIGURABLE_DEFAULT_DOZE_VALUES) public void doubleTapGestureEnabledByDefault() { mContext.getOrCreateTestableResources().addOverride( R.bool.config_dozeDoubleTapGestureEnabled, true); mDozeConfig = new AmbientDisplayConfiguration(mContext); assertThat(mDozeConfig.doubleTapGestureEnabled(UserHandle.USER_CURRENT)).isTrue(); } @Test @EnableFlags(Flags.FLAG_CONFIGURABLE_DEFAULT_DOZE_VALUES) public void doubleTapGestureDisabledByDefault() { mContext.getOrCreateTestableResources().addOverride( R.bool.config_dozeDoubleTapGestureEnabled, false); mDozeConfig = new AmbientDisplayConfiguration(mContext); assertThat(mDozeConfig.doubleTapGestureEnabled(UserHandle.USER_CURRENT)).isFalse(); } } services/core/java/com/android/server/display/feature/display_flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,13 @@ flag { is_fixed_read_only: true } flag { name: "configurable_default_doze_values" namespace: "display_manager" description: "Specify the default doze values in config.xml" bug: "279161929" } flag { name: "brightness_wear_bedtime_mode_clamper" namespace: "display_manager" Loading Loading
core/java/android/hardware/display/AmbientDisplayConfiguration.java +19 −3 Original line number Diff line number Diff line Loading @@ -45,6 +45,9 @@ public class AmbientDisplayConfiguration { private final boolean mAlwaysOnByDefault; private final boolean mPickupGestureEnabledByDefault; private final boolean mScreenOffUdfpsAvailable; private final boolean mDozeEnabledByDefault; private final boolean mTapGestureEnabledByDefault; private final boolean mDoubleTapGestureEnabledByDefault; /** Copied from android.provider.Settings.Secure since these keys are hidden. */ private static final String[] DOZE_SETTINGS = { Loading Loading @@ -74,6 +77,16 @@ public class AmbientDisplayConfiguration { mContext.getResources().getBoolean(R.bool.config_dozePickupGestureEnabled); mScreenOffUdfpsAvailable = mContext.getResources().getBoolean(R.bool.config_screen_off_udfps_enabled); mDozeEnabledByDefault = !com.android.server.display.feature.flags.Flags.configurableDefaultDozeValues() || mContext.getResources().getBoolean(R.bool.config_dozeEnabled); mTapGestureEnabledByDefault = !com.android.server.display.feature.flags.Flags.configurableDefaultDozeValues() || mContext.getResources().getBoolean(R.bool.config_dozeTapGestureEnabled); mDoubleTapGestureEnabledByDefault = !com.android.server.display.feature.flags.Flags.configurableDefaultDozeValues() || mContext.getResources().getBoolean( R.bool.config_dozeDoubleTapGestureEnabled); } /** @hide */ Loading @@ -92,7 +105,8 @@ public class AmbientDisplayConfiguration { /** @hide */ public boolean pulseOnNotificationEnabled(int user) { return boolSettingDefaultOn(Settings.Secure.DOZE_ENABLED, user) return boolSetting(Settings.Secure.DOZE_ENABLED, user, mDozeEnabledByDefault ? 1 : 0) && pulseOnNotificationAvailable(); } Loading @@ -116,7 +130,8 @@ public class AmbientDisplayConfiguration { /** @hide */ public boolean tapGestureEnabled(int user) { return boolSettingDefaultOn(Settings.Secure.DOZE_TAP_SCREEN_GESTURE, user) return boolSetting(Settings.Secure.DOZE_TAP_SCREEN_GESTURE, user, mTapGestureEnabledByDefault ? 1 : 0) && tapSensorAvailable(); } Loading @@ -132,7 +147,8 @@ public class AmbientDisplayConfiguration { /** @hide */ public boolean doubleTapGestureEnabled(int user) { return boolSettingDefaultOn(Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, user) return boolSetting(Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, user, mDoubleTapGestureEnabledByDefault ? 1 : 0) && doubleTapSensorAvailable(); } Loading
core/res/res/values/config.xml +12 −0 Original line number Diff line number Diff line Loading @@ -2964,6 +2964,18 @@ during initialization when the setting is still null. --> <bool name="config_dozePickupGestureEnabled">true</bool> <!-- Control whether doze is enabled by default. This value will be used during initialization when the setting is still null. --> <bool name="config_dozeEnabled">true</bool> <!-- Control whether the single tap gesture is enabled by default. This value will be used during initialization when the setting is still null. --> <bool name="config_dozeTapGestureEnabled">true</bool> <!-- Control whether the double tap gesture is enabled by default. This value will be used during initialization when the setting is still null. --> <bool name="config_dozeDoubleTapGestureEnabled">true</bool> <!-- Control whether the always on display mode is enabled by default. This value will be used during initialization when the setting is still null. --> <bool name="config_dozeAlwaysOnEnabled">true</bool> Loading
core/res/res/values/symbols.xml +3 −0 Original line number Diff line number Diff line Loading @@ -4248,6 +4248,9 @@ <java-symbol type="integer" name="config_autoGroupAtCount" /> <java-symbol type="bool" name="config_dozeAlwaysOnDisplayAvailable" /> <java-symbol type="bool" name="config_dozePickupGestureEnabled" /> <java-symbol type="bool" name="config_dozeEnabled" /> <java-symbol type="bool" name="config_dozeTapGestureEnabled" /> <java-symbol type="bool" name="config_dozeDoubleTapGestureEnabled" /> <java-symbol type="bool" name="config_dozeAlwaysOnEnabled" /> <java-symbol type="bool" name="config_dozeSupportsAodWallpaper" /> <java-symbol type="bool" name="config_displayBlanksAfterDoze" /> Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/doze/DozeConfigurationTest.java +66 −1 Original line number Diff line number Diff line Loading @@ -16,15 +16,20 @@ package com.android.systemui.doze; import static com.google.common.truth.Truth.assertThat; import static junit.framework.TestCase.assertEquals; import android.hardware.display.AmbientDisplayConfiguration; import android.os.UserHandle; import android.platform.test.annotations.EnableFlags; import android.provider.Settings; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.android.internal.R; import com.android.server.display.feature.flags.Flags; import com.android.systemui.SysuiTestCase; import org.junit.Before; Loading @@ -39,11 +44,19 @@ public class DozeConfigurationTest extends SysuiTestCase { @Before public void setup() { mContext.getOrCreateTestableResources().addOverride( R.bool.config_pulseOnNotificationsAvailable, true); mContext.getOrCreateTestableResources().addOverride(R.string.config_dozeComponent, "FakeDozeComponent"); mContext.getOrCreateTestableResources().addOverride( R.array.config_dozeTapSensorPostureMapping, new String[]{"posture1", "posture2"}); mContext.getOrCreateTestableResources().addOverride(R.string.config_dozeDoubleTapSensorType, "FakeDoubleTapSensorType"); mDozeConfig = new AmbientDisplayConfiguration(mContext); } @Test public void alwaysOn_followsConfigByDefault() throws Exception { public void alwaysOn_followsConfigByDefault() { if (!mDozeConfig.alwaysOnAvailable()) { return; } Loading @@ -54,4 +67,56 @@ public class DozeConfigurationTest extends SysuiTestCase { .getBoolean(com.android.internal.R.bool.config_dozeAlwaysOnEnabled); assertEquals(defaultValue, mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT)); } @Test @EnableFlags(Flags.FLAG_CONFIGURABLE_DEFAULT_DOZE_VALUES) public void pulseOnNotificationEnabledByDefault() { mContext.getOrCreateTestableResources().addOverride(R.bool.config_dozeEnabled, true); mDozeConfig = new AmbientDisplayConfiguration(mContext); assertThat(mDozeConfig.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)).isTrue(); } @Test @EnableFlags(Flags.FLAG_CONFIGURABLE_DEFAULT_DOZE_VALUES) public void pulseOnNotificationDisabledByDefault() { mContext.getOrCreateTestableResources().addOverride(R.bool.config_dozeEnabled, false); mDozeConfig = new AmbientDisplayConfiguration(mContext); assertThat(mDozeConfig.pulseOnNotificationEnabled(UserHandle.USER_CURRENT)).isFalse(); } @Test @EnableFlags(Flags.FLAG_CONFIGURABLE_DEFAULT_DOZE_VALUES) public void tapGestureEnabledByDefault() { mContext.getOrCreateTestableResources().addOverride(R.bool.config_dozeTapGestureEnabled, true); mDozeConfig = new AmbientDisplayConfiguration(mContext); assertThat(mDozeConfig.tapGestureEnabled(UserHandle.USER_CURRENT)).isTrue(); } @Test @EnableFlags(Flags.FLAG_CONFIGURABLE_DEFAULT_DOZE_VALUES) public void tapGestureDisabledByDefault() { mContext.getOrCreateTestableResources().addOverride(R.bool.config_dozeTapGestureEnabled, false); mDozeConfig = new AmbientDisplayConfiguration(mContext); assertThat(mDozeConfig.tapGestureEnabled(UserHandle.USER_CURRENT)).isFalse(); } @Test @EnableFlags(Flags.FLAG_CONFIGURABLE_DEFAULT_DOZE_VALUES) public void doubleTapGestureEnabledByDefault() { mContext.getOrCreateTestableResources().addOverride( R.bool.config_dozeDoubleTapGestureEnabled, true); mDozeConfig = new AmbientDisplayConfiguration(mContext); assertThat(mDozeConfig.doubleTapGestureEnabled(UserHandle.USER_CURRENT)).isTrue(); } @Test @EnableFlags(Flags.FLAG_CONFIGURABLE_DEFAULT_DOZE_VALUES) public void doubleTapGestureDisabledByDefault() { mContext.getOrCreateTestableResources().addOverride( R.bool.config_dozeDoubleTapGestureEnabled, false); mDozeConfig = new AmbientDisplayConfiguration(mContext); assertThat(mDozeConfig.doubleTapGestureEnabled(UserHandle.USER_CURRENT)).isFalse(); } }
services/core/java/com/android/server/display/feature/display_flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,13 @@ flag { is_fixed_read_only: true } flag { name: "configurable_default_doze_values" namespace: "display_manager" description: "Specify the default doze values in config.xml" bug: "279161929" } flag { name: "brightness_wear_bedtime_mode_clamper" namespace: "display_manager" Loading