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

Commit 9a71b86c authored by Fiona Campbell's avatar Fiona Campbell
Browse files

Ensure only either RBC or even dimmer can be on

Not Both

Even dimmer is the successor to RBC, so we shouldn't enable both
simultaneously, they are not compatible

Bug: 179428400
Test: manual, atest DisplayServiceTests
Change-Id: I18d5a9c7418b8141afd4b67d121a96cb50ba5274
parent 22da08d8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2854,7 +2854,7 @@
    <!-- Dark UI screen footer action text shown when the when Dark theme turns on/off automatically according to a user bedtime schedule. [CHAR LIMIT=NONE] -->
    <string name="dark_ui_bedtime_footer_action">Bedtime mode settings</string>
    <!-- Even Dimmer setting title. Allows device to reduce brightness even further than standard range. [CHAR LIMIT=NONE] -->
    <string name="even_dimmer_display_title">Even Dimmer</string>
    <string name="even_dimmer_display_title">Even dimmer</string>
    <!-- Even Dimmer setting summary. [CHAR LIMIT=NONE] -->
    <string name="even_dimmer_display_summary">Allow device to go dimmer than usual</string>
+10 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.text.TextUtils;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;

import com.android.server.display.feature.flags.Flags;
import com.android.settings.R;
import com.android.settingslib.PrimarySwitchPreference;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
@@ -88,6 +89,15 @@ public class ReduceBrightColorsPreferenceController

    @Override
    public int getAvailabilityStatus() {
        // Successor to this feature is Even Dimmer
        // found in display/EvenDimmerPreferenceController
        // Only allow RBC if even dimmer is not possible on this device
        if (Flags.evenDimmer() && mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_evenDimmerEnabled)) {
            return UNSUPPORTED_ON_DEVICE;
        }


        return ColorDisplayManager.isReduceBrightColorsAvailable(mContext) ? AVAILABLE
                : UNSUPPORTED_ON_DEVICE;
    }