diff options
5 files changed, 24 insertions, 11 deletions
diff --git a/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java b/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java index c6cb8376d80f..00fa711aed3f 100644 --- a/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java +++ b/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java @@ -20,6 +20,7 @@ import com.android.internal.R; import android.content.Context; import android.os.Build; +import android.os.SystemProperties; import android.provider.Settings; import android.text.TextUtils; @@ -75,13 +76,13 @@ public class AmbientDisplayConfiguration { } public boolean alwaysOnEnabled(int user) { - return boolSettingDefaultOff(Settings.Secure.DOZE_ALWAYS_ON, user) + return boolSettingDefaultOn(Settings.Secure.DOZE_ALWAYS_ON, user) && alwaysOnAvailable(); } public boolean alwaysOnAvailable() { - // TODO: introduce config_dozeAlwaysOnAvailable. For now just debuggable builds. - return Build.IS_DEBUGGABLE && ambientDisplayAvailable(); + return (alwaysOnDisplayDebuggingEnabled() || alwaysOnDisplayAvailable()) + && ambientDisplayAvailable(); } public String ambientDisplayComponent() { @@ -92,6 +93,15 @@ public class AmbientDisplayConfiguration { return !TextUtils.isEmpty(ambientDisplayComponent()); } + private boolean alwaysOnDisplayAvailable() { + return mContext.getResources().getBoolean(R.bool.config_dozeAlwaysOnDisplayAvailable); + } + + private boolean alwaysOnDisplayDebuggingEnabled() { + return SystemProperties.getBoolean("debug.doze.aod", false) && Build.IS_DEBUGGABLE; + } + + private boolean boolSettingDefaultOn(String name, int user) { return boolSetting(name, user, 1); } diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 5abc47d78c38..c76c666f54e0 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -1825,6 +1825,11 @@ <!-- Type of the double tap sensor. Empty if double tap is not supported. --> <string name="config_dozeDoubleTapSensorType" translatable="false"></string> + <!-- Control whether the always on display mode is available. This should only be enabled on + devices where the display has be tuned to be power efficient in DOZE and/or DOZE_SUSPEND + states. --> + <bool name="config_dozeAlwaysOnDisplayAvailable">false</bool> + <!-- Power Management: Specifies whether to decouple the auto-suspend state of the device from the display on/off state. diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index c688414fb892..3ee4325c357b 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2998,13 +2998,9 @@ <!-- ETWS primary messages --> <java-symbol type="string" name="etws_primary_default_message_earthquake" /> - <java-symbol type="string" name="etws_primary_default_message_tsunami" /> - <java-symbol type="string" name="etws_primary_default_message_earthquake_and_tsunami" /> - <java-symbol type="string" name="etws_primary_default_message_test" /> - <java-symbol type="string" name="etws_primary_default_message_others" /> <java-symbol type="bool" name="config_quickSettingsSupported" /> @@ -3032,4 +3028,6 @@ <java-symbol type="bool" name="config_handleVolumeKeysInWindowManager" /> <java-symbol type="integer" name="config_inCallNotificationVolumeRelative" /> + + <java-symbol type="bool" name="config_dozeAlwaysOnDisplayAvailable" /> </resources> diff --git a/packages/SystemUI/res/xml/tuner_prefs.xml b/packages/SystemUI/res/xml/tuner_prefs.xml index 24f29c8ed53f..0c92274ef3d2 100644 --- a/packages/SystemUI/res/xml/tuner_prefs.xml +++ b/packages/SystemUI/res/xml/tuner_prefs.xml @@ -146,7 +146,7 @@ <com.android.systemui.tuner.TunerSwitch android:key="doze_always_on" android:title="@string/tuner_doze_always_on" - sysui:defValue="false" /> + sysui:defValue="true" /> </PreferenceScreen> diff --git a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java index bbe324d7d8d0..64507be764de 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/doze/DozeConfigurationTest.java @@ -16,7 +16,7 @@ package com.android.systemui.doze; -import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import android.os.UserHandle; import android.provider.Settings; @@ -42,7 +42,7 @@ public class DozeConfigurationTest extends SysuiTestCase { } @Test - public void alwaysOn_offByDefault() throws Exception { + public void alwaysOn_onByDefault() throws Exception { if (!mDozeConfig.alwaysOnAvailable()) { return; } @@ -50,6 +50,6 @@ public class DozeConfigurationTest extends SysuiTestCase { Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.DOZE_ALWAYS_ON, null); - assertFalse(mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT)); + assertTrue(mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT)); } } |