summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2013-10-14 17:13:44 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-10-14 17:13:44 +0000
commit6fce81bb26123e502ffb11c4e0236336163d4edd (patch)
treeacfd6a607c17ae0d926dcf6d008695ad4009788e
parent60ba6cc808334138a51dfd2a98ede6b970e4570d (diff)
parent1e89cbccf3f6ce0a6251af5f810bea63fa0f5f44 (diff)
Merge "Recalculate in-call state when activity ends." into klp-dev
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index 1b9f60cc2..2fbbf34bf 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -135,6 +135,7 @@ public class InCallPresenter implements CallList.Listener {
*/
public void setActivity(InCallActivity inCallActivity) {
boolean updateListeners = false;
+ boolean doAttemptCleanup = false;
if (inCallActivity != null) {
if (mInCallActivity == null) {
@@ -171,9 +172,12 @@ public class InCallPresenter implements CallList.Listener {
Log.i(this, "UI Destroyed)");
updateListeners = true;
mInCallActivity = null;
- attemptCleanup();
- }
+ // We attempt cleanup for the destroy case but only after we recalculate the state
+ // to see if we need to come back up or stay shut down. This is why we do the cleanup
+ // after the call to onCallListChange() instead of directly here.
+ doAttemptCleanup = true;
+ }
// Messages can come from the telephony layer while the activity is coming up
// and while the activity is going down. So in both cases we need to recalculate what
@@ -183,11 +187,20 @@ public class InCallPresenter implements CallList.Listener {
// (2) All calls could disconnect and then get a new incoming call before the
// activity is destroyed.
//
- // ... but only if we are still connected (or got a new connection) to the service.
- // Otherwise the service will come back up when it needs us.
- if (updateListeners && mServiceConnected) {
+ // b/1122139 - We previously had a check for mServiceConnected here as well, but there are
+ // cases where we need to recalculate the current state even if the service in not
+ // connected. In particular the case where startOrFinish() is called while the app is
+ // already finish()ing. In that case, we skip updating the state with the knowledge that
+ // we will check again once the activity has finished. That means we have to recalculate the
+ // state here even if the service is disconnected since we may not have finished a state
+ // transition while finish()ing.
+ if (updateListeners) {
onCallListChange(mCallList);
}
+
+ if (doAttemptCleanup) {
+ attemptCleanup();
+ }
}
/**