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

Commit 861b35e1 authored by Geoffrey Pitsch's avatar Geoffrey Pitsch Committed by Android (Google) Code Review
Browse files

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

parents 7eca0300 3ba2623f
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());
    }