summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Johannes Gallmann <gallmann@google.com> 2025-01-27 19:19:39 +0000
committer Johannes Gallmann <gallmann@google.com> 2025-01-27 19:19:39 +0000
commit296bb84a51e4862ff3221e94498b22ba5ede29c9 (patch)
tree4820978b8b6b010a2b120bcb563e61f7d159a1c8
parentdf18c63b70e00417b916cf4b90030f522e2e9477 (diff)
Fix Exception in SysUiState
SysUiState is mocked in many tests. This can cause tests to run into a NullPointerException when setFlag is called. This CL prevents that Exception. Bug: 391721803 Test: HearingDevicesDialogDelegateTest, presubmit Flag: EXEMPT test-only bugfix Change-Id: Ica5ec73d728cff7cb4e56ca98ea4f9ab61f7425a
-rw-r--r--packages/SystemUI/src/com/android/systemui/model/SysUiState.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/model/SysUiState.java b/packages/SystemUI/src/com/android/systemui/model/SysUiState.java
index 67fe0e981b09..1a5e605c96f8 100644
--- a/packages/SystemUI/src/com/android/systemui/model/SysUiState.java
+++ b/packages/SystemUI/src/com/android/systemui/model/SysUiState.java
@@ -79,7 +79,8 @@ public class SysUiState implements Dumpable {
/** Methods to this call can be chained together before calling {@link #commitUpdate(int)}. */
public SysUiState setFlag(@SystemUiStateFlags long flag, boolean enabled) {
- final Boolean overrideOrNull = mSceneContainerPlugin.flagValueOverride(flag);
+ final Boolean overrideOrNull = mSceneContainerPlugin != null
+ ? mSceneContainerPlugin.flagValueOverride(flag) : null;
if (overrideOrNull != null && enabled != overrideOrNull) {
if (DEBUG) {
Log.d(TAG, "setFlag for flag " + flag + " and value " + enabled + " overridden to "