Merge "Config to enable/disable AOD via overlay" into pi-dev
am: b784e6f7bc
Change-Id: I7e6d629b9ca6e87a48c332dab470771c4564985d
This commit is contained in:
@@ -27,9 +27,11 @@ import android.text.TextUtils;
|
|||||||
public class AmbientDisplayConfiguration {
|
public class AmbientDisplayConfiguration {
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
|
private final boolean mAlwaysOnByDefault;
|
||||||
|
|
||||||
public AmbientDisplayConfiguration(Context context) {
|
public AmbientDisplayConfiguration(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
mAlwaysOnByDefault = mContext.getResources().getBoolean(R.bool.config_dozeAlwaysOnEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean enabled(int user) {
|
public boolean enabled(int user) {
|
||||||
@@ -101,8 +103,8 @@ public class AmbientDisplayConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean alwaysOnEnabled(int user) {
|
public boolean alwaysOnEnabled(int user) {
|
||||||
return boolSettingDefaultOn(Settings.Secure.DOZE_ALWAYS_ON, user) && alwaysOnAvailable()
|
return boolSetting(Settings.Secure.DOZE_ALWAYS_ON, user, mAlwaysOnByDefault ? 1 : 0)
|
||||||
&& !accessibilityInversionEnabled(user);
|
&& alwaysOnAvailable() && !accessibilityInversionEnabled(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean alwaysOnAvailable() {
|
public boolean alwaysOnAvailable() {
|
||||||
|
|||||||
@@ -2085,6 +2085,10 @@
|
|||||||
states. -->
|
states. -->
|
||||||
<bool name="config_dozeAlwaysOnDisplayAvailable">false</bool>
|
<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 -->
|
<!-- Whether the display blanks itself when transitioning from a doze to a non-doze state -->
|
||||||
<bool name="config_displayBlanksAfterDoze">false</bool>
|
<bool name="config_displayBlanksAfterDoze">false</bool>
|
||||||
|
|
||||||
|
|||||||
@@ -3231,6 +3231,7 @@
|
|||||||
<java-symbol type="dimen" name="config_inCallNotificationVolume" />
|
<java-symbol type="dimen" name="config_inCallNotificationVolume" />
|
||||||
<java-symbol type="string" name="config_inCallNotificationSound" />
|
<java-symbol type="string" name="config_inCallNotificationSound" />
|
||||||
<java-symbol type="bool" name="config_dozeAlwaysOnDisplayAvailable" />
|
<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_displayBlanksAfterDoze" />
|
||||||
<java-symbol type="bool" name="config_displayBrightnessBucketsInDoze" />
|
<java-symbol type="bool" name="config_displayBrightnessBucketsInDoze" />
|
||||||
<java-symbol type="integer" name="config_storageManagerDaystoRetainDefault" />
|
<java-symbol type="integer" name="config_storageManagerDaystoRetainDefault" />
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.systemui.doze;
|
package com.android.systemui.doze;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static junit.framework.TestCase.assertEquals;
|
||||||
|
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
@@ -42,14 +42,15 @@ public class DozeConfigurationTest extends SysuiTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void alwaysOn_onByDefault() throws Exception {
|
public void alwaysOn_followsConfigByDefault() throws Exception {
|
||||||
if (!mDozeConfig.alwaysOnAvailable()) {
|
if (!mDozeConfig.alwaysOnAvailable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.DOZE_ALWAYS_ON,
|
Settings.Secure.putString(mContext.getContentResolver(), Settings.Secure.DOZE_ALWAYS_ON,
|
||||||
null);
|
null);
|
||||||
|
boolean defaultValue = mContext.getResources()
|
||||||
assertTrue(mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT));
|
.getBoolean(com.android.internal.R.bool.config_dozeAlwaysOnEnabled);
|
||||||
|
assertEquals(mDozeConfig.alwaysOnEnabled(UserHandle.USER_CURRENT), defaultValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user