From cda685dbe377639b2bc3051bac37e7cb0778e2a3 Mon Sep 17 00:00:00 2001 From: Evan Laird Date: Mon, 22 Jan 2018 18:25:17 -0500 Subject: [PATCH] Fix crash when PhoneStatusBarView has no cutout Not all layouts will have cutouts after all, and PhoneStatusBarView can't expect there to be one for no reason. Test: manually verified that removing the cutout won't cause issues Change-Id: Id02b467c7a650c12ab61f294eec576420dccd130 Fixes: 72325926 --- .../systemui/statusbar/phone/PhoneStatusBarView.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java index e8b28f21c2c2c..b181212553534 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java @@ -62,6 +62,7 @@ public class PhoneStatusBarView extends PanelBar { }; private DarkReceiver mBattery; private int mLastOrientation; + @Nullable private View mCutoutSpace; @Nullable private DisplayCutout mDisplayCutout; @@ -284,6 +285,11 @@ public class PhoneStatusBarView extends PanelBar { } private void updateCutoutLocation() { + // Not all layouts have a cutout (e.g., Car) + if (mCutoutSpace == null) { + return; + } + if (mDisplayCutout == null || mDisplayCutout.isEmpty() || mLastOrientation != ORIENTATION_PORTRAIT) { mCutoutSpace.setVisibility(View.GONE);