Enable Always On mode by default.
Also, add a config value for always on display availability. Test: runtest -x tests/src/com/android/systemui/doze Change-Id: Id5e0136a5bed0eac78ad48147b0bef8311b06986
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user