From 7dac444afe26abaec15dfbe55a1548f785ad2521 Mon Sep 17 00:00:00 2001 From: Chiao Cheng Date: Fri, 13 Sep 2013 13:50:07 -0700 Subject: Fix NullPointerException. The existing null check was being overridden by check for incoming call. Prioritize the null check first. Bug: 10727364 Change-Id: Id0127a6f3634876126c1f13c810f1d1e54e8d203 --- InCallUI/src/com/android/incallui/StatusBarNotifier.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/InCallUI/src/com/android/incallui/StatusBarNotifier.java b/InCallUI/src/com/android/incallui/StatusBarNotifier.java index ad1a67e77..bdbb1253d 100644 --- a/InCallUI/src/com/android/incallui/StatusBarNotifier.java +++ b/InCallUI/src/com/android/incallui/StatusBarNotifier.java @@ -461,6 +461,14 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, * Returns true if notification should not be shown in the current state. */ private boolean shouldSuppressNotification(InCallState state, Call call) { + + // We can still be in the INCALL state when a call is disconnected (in order to show + // the "Call ended" screen. So check that we have an active connection too. + if (call == null) { + Log.v(this, "suppressing: no call"); + return true; + } + // Suppress the in-call notification if the InCallScreen is the // foreground activity, since it's already obvious that you're on a // call. (The status bar icon is needed only if you navigate *away* @@ -473,13 +481,6 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener, shouldSuppress = true; } - // We can still be in the INCALL state when a call is disconnected (in order to show - // the "Call ended" screen. So check that we have an active connection too. - if (call == null) { - Log.v(this, "suppressing: no call"); - shouldSuppress = true; - } - // If there's an incoming ringing call: always show the // notification, since the in-call notification is what actually // launches the incoming call UI in the first place (see -- cgit v1.2.3