diff options
author | Nancy Chen <nancychen@google.com> | 2014-08-08 18:28:08 -0700 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2014-08-19 10:50:49 -0700 |
commit | 537431d81624ea24d71df8e42251e795dcdc0d3c (patch) | |
tree | ecb252c9f426ddf872affcd3372d0a336b3ac0c6 | |
parent | 3718dcb345e77e421ab18a760e48f0c3a760fcca (diff) |
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
3 files changed, 21 insertions, 8 deletions
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<CallCardPresenter, CallCardPr @Override public void setPrimaryName(String name, boolean nameIsNumber) { if (TextUtils.isEmpty(name)) { - mPrimaryName.setText(""); + mPrimaryName.setText(null); } else { mPrimaryName.setText(name); @@ -384,7 +384,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr public void setPrimaryPhoneNumber(String number) { // Set the number if (TextUtils.isEmpty(number)) { - mPhoneNumber.setText(""); + mPhoneNumber.setText(null); mPhoneNumber.setVisibility(View.GONE); } else { mPhoneNumber.setText(number); @@ -510,6 +510,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr if (callStateAnimation != null) { callStateAnimation.cancel(); } + mCallStateLabel.setText(null); mCallStateLabel.setAlpha(0); mCallStateLabel.setVisibility(View.GONE); diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index ce17109e1..a8b570211 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -187,8 +187,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> 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) { @@ -1000,6 +1002,18 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener { } /** + * 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. */ public static boolean isRtl() { |