Merge "Disable AOD when accessibility color inversion is on." into oc-dr1-dev
diff --git a/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java b/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java
index df9c27b..1168eec 100644
--- a/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java
+++ b/core/java/com/android/internal/hardware/AmbientDisplayConfiguration.java
@@ -94,8 +94,8 @@
}
public boolean alwaysOnEnabled(int user) {
- return boolSettingDefaultOn(Settings.Secure.DOZE_ALWAYS_ON, user)
- && alwaysOnAvailable();
+ return boolSettingDefaultOn(Settings.Secure.DOZE_ALWAYS_ON, user) && alwaysOnAvailable()
+ && !accessibilityInversionEnabled(user);
}
public boolean alwaysOnAvailable() {
@@ -103,10 +103,18 @@
&& ambientDisplayAvailable();
}
+ public boolean alwaysOnAvailableForUser(int user) {
+ return alwaysOnAvailable() && !accessibilityInversionEnabled(user);
+ }
+
public String ambientDisplayComponent() {
return mContext.getResources().getString(R.string.config_dozeComponent);
}
+ private boolean accessibilityInversionEnabled(int user) {
+ return boolSettingDefaultOff(Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED, user);
+ }
+
private boolean ambientDisplayAvailable() {
return !TextUtils.isEmpty(ambientDisplayComponent());
}