Merge "Fix crash due to incompatible type" into main

This commit is contained in:
Tom Hsu
2024-03-27 05:55:07 +00:00
committed by Android (Google) Code Review

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())) {