Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7662de27 authored by Geoffrey Pitsch's avatar Geoffrey Pitsch Committed by android-build-merger
Browse files

Merge "Disable AOD when accessibility color inversion is on." into oc-dr1-dev

am: 861b35e1

Change-Id: I4ee3ad06138a66b47bca6e56fbbd0bd970d91e08
parents fb80235f 861b35e1
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -94,8 +94,8 @@ public class AmbientDisplayConfiguration {
    }

    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 @@ public class AmbientDisplayConfiguration {
                && 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());
    }