From 3d40072e8747373097a92906dbce99e58c92ffc2 Mon Sep 17 00:00:00 2001 From: shawnlin Date: Thu, 15 Oct 2020 20:32:29 +0800 Subject: [PATCH] Fix null exception on config change when ScreenDecoration is disabled Return early on callbacks - onConfigurationChanged() - onTuningChanged() Bug: 169438063 Test: 1. disable ScreenDecorations: - adb shell setprop debug.disable_screen_decorations true - adb shell pidof com.android.systemui |xargs -i adb shell kill -9 {} 2. rotate device Change-Id: Icadfdd0f10e252677392443f3280e5620d0fa797 --- .../src/com/android/systemui/ScreenDecorations.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java index c4a305ec41e24..2592a2c4c7684 100644 --- a/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java +++ b/packages/SystemUI/src/com/android/systemui/ScreenDecorations.java @@ -582,6 +582,10 @@ public class ScreenDecorations extends SystemUI implements Tunable { @Override protected void onConfigurationChanged(Configuration newConfig) { + if (DEBUG_DISABLE_SCREEN_DECORATIONS) { + Log.i(TAG, "ScreenDecorations is disabled"); + return; + } mHandler.post(() -> { int oldRotation = mRotation; mPendingRotationChange = false; @@ -766,6 +770,10 @@ public class ScreenDecorations extends SystemUI implements Tunable { @Override public void onTuningChanged(String key, String newValue) { + if (DEBUG_DISABLE_SCREEN_DECORATIONS) { + Log.i(TAG, "ScreenDecorations is disabled"); + return; + } mHandler.post(() -> { if (mOverlays == null) return; if (SIZE.equals(key)) {