Also, add a config value for always on display availability.
Test: runtest -x tests/src/com/android/systemui/doze
Change-Id: Id5e0136a5bed0eac78ad48147b0bef8311b06986
import android.content.Context;
import android.os.Build;
+import android.os.SystemProperties;
import android.provider.Settings;
import android.text.TextUtils;
}
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() {
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);
}
<!-- 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.
<!-- 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" />
<java-symbol type="bool" name="config_handleVolumeKeysInWindowManager" />
<java-symbol type="integer" name="config_inCallNotificationVolumeRelative" />
+
+ <java-symbol type="bool" name="config_dozeAlwaysOnDisplayAvailable" />
</resources>
<com.android.systemui.tuner.TunerSwitch
android:key="doze_always_on"
android:title="@string/tuner_doze_always_on"
- sysui:defValue="false" />
+ sysui:defValue="true" />
</PreferenceScreen>
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;
}
@Test
- public void alwaysOn_offByDefault() throws Exception {
+ public void alwaysOn_onByDefault() throws Exception {
if (!mDozeConfig.alwaysOnAvailable()) {
return;
}
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.DOZE_ALWAYS_ON,
null);
- assertFalse(mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT));
+ assertTrue(mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT));
}
}