Fix crash due to incompatible type

fix: 331182785
Test: Manual test
Change-Id: I20c150845caad1c14cad35f661c31e36def968ac
This commit is contained in:
tomhsu
2024-03-26 05:00:29 +00:00
parent f5d8f4afa9
commit 32a501562c

View File

@@ -62,6 +62,10 @@ public class AutoBrightnessPreferenceController extends TogglePreferenceControll
@Override
public void updateState(Preference preference) {
super.updateState(preference);
if (!(preference instanceof PrimarySwitchPreference)) {
return;
}
PrimarySwitchPreference pref = (PrimarySwitchPreference) preference;
if (pref.isEnabled() && UserManager.get(mContext).hasBaseUserRestriction(
UserManager.DISALLOW_CONFIG_BRIGHTNESS, Process.myUserHandle())) {