Loading core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java +4 −2 Original line number Diff line number Diff line Loading @@ -27,9 +27,11 @@ import android.text.TextUtils; public class AmbientDisplayConfiguration { private final Context mContext; private final boolean mAlwaysOnByDefault; public AmbientDisplayConfiguration(Context context) { mContext = context; mAlwaysOnByDefault = mContext.getResources().getBoolean(R.bool.config_dozeAlwaysOnEnabled); } public boolean enabled(int user) { Loading Loading @@ -101,8 +103,8 @@ public class AmbientDisplayConfiguration { } public boolean alwaysOnEnabled(int user) { return boolSettingDefaultOn(Settings.Secure.DOZE_ALWAYS_ON, user) && alwaysOnAvailable() && !accessibilityInversionEnabled(user); return boolSetting(Settings.Secure.DOZE_ALWAYS_ON, user, mAlwaysOnByDefault ? 1 : 0) && alwaysOnAvailable() && !accessibilityInversionEnabled(user); } public boolean alwaysOnAvailable() { Loading core/res/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -2085,6 +2085,10 @@ states. --> <bool name="config_dozeAlwaysOnDisplayAvailable">false</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> <!-- Whether the display blanks itself when transitioning from a doze to a non-doze state --> <bool name="config_displayBlanksAfterDoze">false</bool> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -3231,6 +3231,7 @@ <java-symbol type="dimen" name="config_inCallNotificationVolume" /> <java-symbol type="string" name="config_inCallNotificationSound" /> <java-symbol type="bool" name="config_dozeAlwaysOnDisplayAvailable" /> <java-symbol type="bool" name="config_dozeAlwaysOnEnabled" /> <java-symbol type="bool" name="config_displayBlanksAfterDoze" /> <java-symbol type="bool" name="config_displayBrightnessBucketsInDoze" /> <java-symbol type="integer" name="config_storageManagerDaystoRetainDefault" /> Loading packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java +5 −4 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.systemui.doze; import static org.junit.Assert.assertTrue; import static junit.framework.TestCase.assertEquals; import android.os.UserHandle; import android.provider.Settings; Loading @@ -42,14 +42,15 @@ public class DozeConfigurationTest extends SysuiTestCase { } @Test public void alwaysOn_onByDefault() throws Exception { public void alwaysOn_followsConfigByDefault() throws Exception { if (!mDozeConfig.alwaysOnAvailable()) { return; } Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.DOZE_ALWAYS_ON, null); assertTrue(mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT)); boolean defaultValue = mContext.getResources() .getBoolean(com.android.internal.R.bool.config_dozeAlwaysOnEnabled); assertEquals(mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT), defaultValue); } } Loading
core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java +4 −2 Original line number Diff line number Diff line Loading @@ -27,9 +27,11 @@ import android.text.TextUtils; public class AmbientDisplayConfiguration { private final Context mContext; private final boolean mAlwaysOnByDefault; public AmbientDisplayConfiguration(Context context) { mContext = context; mAlwaysOnByDefault = mContext.getResources().getBoolean(R.bool.config_dozeAlwaysOnEnabled); } public boolean enabled(int user) { Loading Loading @@ -101,8 +103,8 @@ public class AmbientDisplayConfiguration { } public boolean alwaysOnEnabled(int user) { return boolSettingDefaultOn(Settings.Secure.DOZE_ALWAYS_ON, user) && alwaysOnAvailable() && !accessibilityInversionEnabled(user); return boolSetting(Settings.Secure.DOZE_ALWAYS_ON, user, mAlwaysOnByDefault ? 1 : 0) && alwaysOnAvailable() && !accessibilityInversionEnabled(user); } public boolean alwaysOnAvailable() { Loading
core/res/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -2085,6 +2085,10 @@ states. --> <bool name="config_dozeAlwaysOnDisplayAvailable">false</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> <!-- Whether the display blanks itself when transitioning from a doze to a non-doze state --> <bool name="config_displayBlanksAfterDoze">false</bool> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -3231,6 +3231,7 @@ <java-symbol type="dimen" name="config_inCallNotificationVolume" /> <java-symbol type="string" name="config_inCallNotificationSound" /> <java-symbol type="bool" name="config_dozeAlwaysOnDisplayAvailable" /> <java-symbol type="bool" name="config_dozeAlwaysOnEnabled" /> <java-symbol type="bool" name="config_displayBlanksAfterDoze" /> <java-symbol type="bool" name="config_displayBrightnessBucketsInDoze" /> <java-symbol type="integer" name="config_storageManagerDaystoRetainDefault" /> Loading
packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java +5 −4 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.systemui.doze; import static org.junit.Assert.assertTrue; import static junit.framework.TestCase.assertEquals; import android.os.UserHandle; import android.provider.Settings; Loading @@ -42,14 +42,15 @@ public class DozeConfigurationTest extends SysuiTestCase { } @Test public void alwaysOn_onByDefault() throws Exception { public void alwaysOn_followsConfigByDefault() throws Exception { if (!mDozeConfig.alwaysOnAvailable()) { return; } Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.DOZE_ALWAYS_ON, null); assertTrue(mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT)); boolean defaultValue = mContext.getResources() .getBoolean(com.android.internal.R.bool.config_dozeAlwaysOnEnabled); assertEquals(mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT), defaultValue); } }