Merge "set enabled state of persist switch when Extra Dim state is changed" into sc-dev

This commit is contained in:
Sally Yuen
2021-05-04 15:26:12 +00:00
committed by Android (Google) Code Review

View File

@@ -20,6 +20,8 @@ import android.content.Context;
import android.hardware.display.ColorDisplayManager;
import android.provider.Settings;
import androidx.preference.Preference;
import com.android.settings.core.TogglePreferenceController;
/** PreferenceController for persisting feature activation state after a restart. */
@@ -54,4 +56,10 @@ public class ReduceBrightColorsPersistencePreferenceController extends TogglePre
return Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.REDUCE_BRIGHT_COLORS_PERSIST_ACROSS_REBOOTS, (isChecked ? 1 : 0));
}
@Override
public final void updateState(Preference preference) {
super.updateState(preference);
preference.setEnabled(mColorDisplayManager.isReduceBrightColorsActivated());
}
}