summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorIhab Awad <ihab@google.com>2014-09-08 09:39:57 -0700
committerIhab Awad <ihab@google.com>2014-09-09 16:33:39 -0700
commitb268ca990327cb2cb6848d10a241041d2e99e1c5 (patch)
tree17109d42022d249feeb985c901a1625d24557712 /InCallUI
parente7e294d880c8cdda8ddec98624f1a986af5d9ee0 (diff)
Fix incorrect call state in InCallPresenter
Bug: 15195036 Change-Id: Id33577c2d9215fc7eb274b163c755684931bbc34
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java33
1 files changed, 23 insertions, 10 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index d633f27c8..1d0ec8762 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -823,7 +823,12 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener {
if (isActivityStarted()) {
mInCallActivity.dismissPendingDialogs();
}
- startUi(newState);
+ if (!startUi(newState)) {
+ // startUI refused to start the UI. This indicates that it needed to restart the
+ // activity. When it finally restarts, it will call us back, so we do not actually
+ // change the state yet (we return mInCallState instead of newState).
+ return mInCallState;
+ }
} else if (newState == InCallState.NO_CALLS) {
// The new state is the no calls state. Tear everything down.
attemptFinishActivity();
@@ -833,10 +838,9 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener {
return newState;
}
- private void startUi(InCallState inCallState) {
- final Call incomingCall = mCallList.getIncomingCall();
- final boolean isCallWaiting = (incomingCall != null &&
- incomingCall.getState() == Call.State.CALL_WAITING);
+ private boolean startUi(InCallState inCallState) {
+ boolean isCallWaiting = mCallList.getActiveCall() != null &&
+ mCallList.getIncomingCall() != null;
// If the screen is off, we need to make sure it gets turned on for incoming calls.
// This normally works just fine thanks to FLAG_TURN_SCREEN_ON but that only works
@@ -844,14 +848,23 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener {
// for the call waiting case, we finish() the current activity and start a new one.
// There should be no jank from this since the screen is already off and will remain so
// until our new activity is up.
- if (mProximitySensor.isScreenReallyOff() && isCallWaiting) {
- if (isActivityStarted()) {
+
+ if (isCallWaiting) {
+ if (mProximitySensor.isScreenReallyOff() && isActivityStarted()) {
mInCallActivity.finish();
+ // When the activity actually finishes, we will start it again if there are
+ // any active calls, so we do not need to start it explicitly here. Note, we
+ // actually get called back on this function to restart it.
+
+ // We return false to indicate that we did not actually start the UI.
+ return false;
+ } else {
+ showInCall(false, false);
}
- mInCallActivity = null;
+ } else {
+ mStatusBarNotifier.updateNotification(inCallState, mCallList);
}
-
- mStatusBarNotifier.updateNotification(inCallState, mCallList);
+ return true;
}
/**