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
This commit is contained in:
Evan Laird
2018-01-22 18:25:17 -05:00
parent 129f8ae2e8
commit cda685dbe3

View File

@@ -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);