From 118f484424f3e5649833df42a7e613f41b2b2ecd Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Sun, 7 Oct 2012 20:38:39 -0400 Subject: [PATCH] Fix NPE on devices without notification panel help clings. Bug: 7302657 Change-Id: Ia161ea2ef74ef1dfbab55dacaa7274ebc2d66439 --- .../systemui/statusbar/phone/PhoneStatusBar.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 0161f1de78495..f171662a53d99 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1376,14 +1376,20 @@ public class PhoneStatusBar extends BaseStatusBar { } public void showCling() { + // lazily inflate this to accommodate orientation change + final ViewStub stub = (ViewStub) mStatusBarWindow.findViewById(R.id.status_bar_cling_stub); + if (stub == null) { + mClingShown = true; + return; // no clings on this device + } + mSuppressStatusBarDrags = true; mHandler.postDelayed(new Runnable() { @Override public void run() { - // lazily inflate this to accommodate orientation change - ViewStub stub = (ViewStub) mStatusBarWindow.findViewById(R.id.status_bar_cling_stub); mCling = (ViewGroup) stub.inflate(); + mCling.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) {