From 3e742b533739bbde7d02b5a505249567571c9242 Mon Sep 17 00:00:00 2001 From: tomhsu Date: Tue, 26 Mar 2024 05:00:29 +0000 Subject: [PATCH] Fix crash due to incompatible type fix: 331182785 Test: Manual test (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:1c82f6dae63cbec0e014f94a017fb9ce86dc460e) Merged-In: I20c150845caad1c14cad35f661c31e36def968ac Change-Id: I20c150845caad1c14cad35f661c31e36def968ac --- .../settings/display/AutoBrightnessPreferenceController.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/com/android/settings/display/AutoBrightnessPreferenceController.java b/src/com/android/settings/display/AutoBrightnessPreferenceController.java index bf211837e69..3f9be2fd6cf 100644 --- a/src/com/android/settings/display/AutoBrightnessPreferenceController.java +++ b/src/com/android/settings/display/AutoBrightnessPreferenceController.java @@ -62,6 +62,10 @@ public int getAvailabilityStatus() { @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())) {