diff options
author | Santos Cordon <santoscordon@google.com> | 2013-09-15 15:43:33 -0700 |
---|---|---|
committer | Santos Cordon <santoscordon@google.com> | 2013-09-15 17:01:05 -0700 |
commit | be55a98f79c4721af7e4b1bd6854271d19f9333f (patch) | |
tree | 8dfb07a1d49ee8cb46ff81292fafebdb4fd74955 | |
parent | e91cacacb3dd7ddab7ee31f83d357a6cf14d3e1f (diff) |
Shut down if UI starts after service is disconnected.
Additionally, this change can cause multiple calls to attemptToCleanup()
so the change adds appropriate null checks.
bug:10767438
Change-Id: Ieeb4a00653a6b3bcacca105d649ca9efd8ae8d44
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallPresenter.java | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 47b0871ae..82da5b8f7 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -127,6 +127,16 @@ public class InCallPresenter implements CallList.Listener { boolean updateListeners = false; if (inCallActivity != null) { + // When the UI comes up, we need to first check the state of the Service. + // If the service is not attached, that means that a call probably connected and + // then immediately disconnected before the UI was able to come up. A disconnected + // service means we dont have calls, so start tearing down the UI instead. + if (mServiceConnected == false) { + inCallActivity.finish(); + attemptCleanup(); + return; + } + if (mInCallActivity == null) { updateListeners = true; Log.i(this, "UI Initialized"); @@ -421,17 +431,23 @@ public class InCallPresenter implements CallList.Listener { // blow away stale contact info so that we get fresh data on // the next set of calls - mContactInfoCache.clearCache(); + if (mContactInfoCache != null) { + mContactInfoCache.clearCache(); + } mContactInfoCache = null; mProximitySensor = null; mAudioModeProvider = null; - removeListener(mStatusBarNotifier); + if (mStatusBarNotifier != null) { + removeListener(mStatusBarNotifier); + } mStatusBarNotifier = null; - mCallList.removeListener(this); + if (mCallList != null) { + mCallList.removeListener(this); + } mCallList = null; mContext = null; |