Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eede7c1f authored by Yorke Lee's avatar Yorke Lee
Browse files

Fix two animations when using Connection.setInitialized

STATE_NEW has no meaning within InCallUI and can confuse
the internal logic. Treat it as STATE_CONNECTING for purposes
of state tracking.

Also, track whether the activity is visible rather than
whether it is the foreground activity (by tracking onStart/onStop
vs onResume/onPause). This fixes some unexpected UI transitions
when a dialog (e.g. wifi-calling dialog) shows up over the InCallUI.

Bug: 19217176
Change-Id: Ifa5953e27aa4ed777ed8798c628df1bdc96ed1eb
parent f3a65b2e
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -318,7 +318,6 @@ public class Call {
    private static int translateState(int state) {
        switch (state) {
            case android.telecom.Call.STATE_NEW:
                return Call.State.NEW;
            case android.telecom.Call.STATE_CONNECTING:
                return Call.State.CONNECTING;
            case android.telecom.Call.STATE_SELECT_PHONE_ACCOUNT:
+9 −11
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ public class InCallActivity extends Activity implements FragmentDisplayManager {
    private ConferenceManagerFragment mConferenceManagerFragment;
    private FragmentManager mChildFragmentManager;

    private boolean mIsForegroundActivity;
    private boolean mIsVisible;
    private AlertDialog mDialog;

    /** Use to pass 'showDialpad' from {@link #onNewIntent} to {@link #onResume} */
@@ -252,6 +252,8 @@ public class InCallActivity extends Activity implements FragmentDisplayManager {
        Log.d(this, "onStart()...");
        super.onStart();

        mIsVisible = true;

        if (mOrientationEventListener.canDetectOrientation()) {
            Log.v(this, "Orientation detection enabled.");
            mOrientationEventListener.enable();
@@ -271,8 +273,6 @@ public class InCallActivity extends Activity implements FragmentDisplayManager {
        Log.i(this, "onResume()...");
        super.onResume();

        mIsForegroundActivity = true;

        InCallPresenter.getInstance().setThemeColors();
        InCallPresenter.getInstance().onUiShowing(true);

@@ -298,10 +298,6 @@ public class InCallActivity extends Activity implements FragmentDisplayManager {
    @Override
    protected void onPause() {
        Log.d(this, "onPause()...");
        super.onPause();

        mIsForegroundActivity = false;

        if (mDialpadFragment != null ) {
            mDialpadFragment.onDialerKeyUp(null);
        }
@@ -310,11 +306,13 @@ public class InCallActivity extends Activity implements FragmentDisplayManager {
        if (isFinishing()) {
            InCallPresenter.getInstance().unsetActivity(this);
        }
        super.onPause();
    }

    @Override
    protected void onStop() {
        Log.d(this, "onStop()...");
        mIsVisible = false;
        InCallPresenter.getInstance().updateIsChangingConfigurations();
        InCallPresenter.getInstance().onActivityStopped();
        mOrientationEventListener.disable();
@@ -353,10 +351,10 @@ public class InCallActivity extends Activity implements FragmentDisplayManager {
    }

    /**
     * Returns true when theActivity is in foreground (between onResume and onPause).
     * Returns true when the Activity is currently visible (between onStart and onStop).
     */
    /* package */ boolean isForegroundActivity() {
        return mIsForegroundActivity;
    /* package */ boolean isVisible() {
        return mIsVisible;
    }

    private boolean hasPendingDialogs() {
@@ -791,7 +789,7 @@ public class InCallActivity extends Activity implements FragmentDisplayManager {
    }

    public void showPostCharWaitDialog(String callId, String chars) {
        if (isForegroundActivity()) {
        if (isVisible()) {
            final PostCharDialogFragment fragment = new PostCharDialogFragment(callId,  chars);
            fragment.show(getFragmentManager(), "postCharWait");

+1 −1
Original line number Diff line number Diff line
@@ -738,7 +738,7 @@ public class InCallPresenter implements CallList.Listener,
     * Returns true if the incall app is the foreground application.
     */
    public boolean isShowingInCallUi() {
        return (isActivityStarted() && mInCallActivity.isForegroundActivity());
        return (isActivityStarted() && mInCallActivity.isVisible());
    }

    /**