From 537431d81624ea24d71df8e42251e795dcdc0d3c Mon Sep 17 00:00:00 2001 From: Nancy Chen Date: Fri, 8 Aug 2014 18:28:08 -0700 Subject: Ensure the InCallUI does not reanimate when it already is shown. Closely restrict the cases where the InCallUI is initialized. Bug: 16898291 Change-Id: I78be81f140b8de24fdd4a27cdf0aa01c6a230e3a --- .../src/com/android/incallui/CallCardFragment.java | 5 +++-- .../com/android/incallui/CallCardPresenter.java | 2 -- .../src/com/android/incallui/InCallPresenter.java | 22 ++++++++++++++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) (limited to 'InCallUI/src/com') diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index e17b9dff6..84d1aba34 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -360,7 +360,7 @@ public class CallCardFragment extends BaseFragment Log.d(this, "Primary call: " + primary); Log.d(this, "Secondary call: " + secondary); - final boolean outgoingCallReady = newState == InCallState.OUTGOING && - oldState == InCallState.PENDING_OUTGOING; final boolean primaryChanged = !Call.areSame(mPrimary, primary); final boolean secondaryChanged = !Call.areSame(mSecondary, secondary); diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java index 66890eb8c..49e719199 100644 --- a/InCallUI/src/com/android/incallui/InCallPresenter.java +++ b/InCallUI/src/com/android/incallui/InCallPresenter.java @@ -790,16 +790,18 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { // A new outgoing call indicates that the user just now dialed a number and when that // happens we need to display the screen immediately or show an account picker dialog if - // no default is set. + // no default is set. However, if the main InCallUI is already visible, we do not want to + // re-initiate the start-up animation, so we do not need to do anything here. // // It is also possible to go into an intermediate state where the call has been initiated // but Telecomm has not yet returned with the details of the call (handle, gateway, etc.). - // This pending outgoing state also launches the call screen. + // This pending outgoing state can also launch the call screen. // // This is different from the incoming call sequence because we do not need to shock the // user with a top-level notification. Just show the call UI normally. + final boolean mainUiNotVisible = !isShowingInCallUi() || !getCallCardFragmentVisible(); final boolean showCallUi = ((InCallState.PENDING_OUTGOING == newState || - InCallState.OUTGOING == newState) || showAccountPicker); + InCallState.OUTGOING == newState) && mainUiNotVisible); // TODO: Can we be suddenly in a call without it having been in the outgoing or incoming // state? I havent seen that but if it can happen, the code below should be enabled. @@ -815,7 +817,7 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { return mInCallState; } - if (showCallUi) { + if (showCallUi || showAccountPicker) { Log.i(this, "Start in call UI"); showInCall(false /* showDialpad */, !showAccountPicker /* newOutgoingCall */); } else if (startStartupSequence) { @@ -999,6 +1001,18 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { return mInCallActivity.getCallCardFragment().getSpaceBesideCallCard(); } + /** + * Returns whether the call card fragment is currently visible. + * + * @return True if the call card fragment is visible. + */ + public boolean getCallCardFragmentVisible() { + if (mInCallActivity != null) { + return mInCallActivity.getCallCardFragment().isVisible(); + } + return false; + } + /** * @return True if the application is currently running in a right-to-left locale. */ -- cgit v1.2.3