Merge "Config to enable/disable AOD via overlay" into pi-dev
This commit is contained in:
@@ -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) {
|
||||
@@ -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() {
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -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;
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user