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

Commit d5d929fd authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix abnormal state of ImsPhoneCall after hangup"

parents c56a7070 0fc2f4d7
Loading
Loading
Loading
Loading
+10 −4
Original line number Original line Diff line number Diff line
@@ -199,7 +199,9 @@ public class ImsPhoneCall extends Call {
            }
            }


            if (hasOnlyDisconnectedConnections) {
            if (hasOnlyDisconnectedConnections) {
                synchronized(this) {
                    mState = State.DISCONNECTED;
                    mState = State.DISCONNECTED;
                }
                if (VDBG) {
                if (VDBG) {
                    Rlog.v(LOG_TAG, "connectionDisconnected : " + mCallContext + " state = " +
                    Rlog.v(LOG_TAG, "connectionDisconnected : " + mCallContext + " state = " +
                            mState);
                            mState);
@@ -235,13 +237,17 @@ public class ImsPhoneCall extends Call {
     * Called when this Call is being hung up locally (eg, user pressed "end")
     * Called when this Call is being hung up locally (eg, user pressed "end")
     */
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    void
    @VisibleForTesting
    onHangupLocal() {
    public void onHangupLocal() {
        for (int i = 0, s = mConnections.size(); i < s; i++) {
        for (int i = 0, s = mConnections.size(); i < s; i++) {
            ImsPhoneConnection cn = (ImsPhoneConnection)mConnections.get(i);
            ImsPhoneConnection cn = (ImsPhoneConnection)mConnections.get(i);
            cn.onHangupLocal();
            cn.onHangupLocal();
        }
        }
        synchronized(this) {
            if (mState.isAlive()) {
                mState = State.DISCONNECTING;
                mState = State.DISCONNECTING;
            }
        }
        if (VDBG) {
        if (VDBG) {
            Rlog.v(LOG_TAG, "onHangupLocal : " + mCallContext + " state = " + mState);
            Rlog.v(LOG_TAG, "onHangupLocal : " + mCallContext + " state = " + mState);
        }
        }
+2 −1
Original line number Original line Diff line number Diff line
@@ -90,7 +90,6 @@ public class ImsPhoneCallTest extends TelephonyTest {
    }
    }


    @FlakyTest
    @FlakyTest
    @Ignore
    @Test
    @Test
    @SmallTest
    @SmallTest
    public void testConnectionDisconnected() {
    public void testConnectionDisconnected() {
@@ -106,6 +105,8 @@ public class ImsPhoneCallTest extends TelephonyTest {
        doReturn(Call.State.DISCONNECTED).when(mConnection2).getState();
        doReturn(Call.State.DISCONNECTED).when(mConnection2).getState();
        mImsCallUT.connectionDisconnected(null);
        mImsCallUT.connectionDisconnected(null);
        assertEquals(Call.State.DISCONNECTED, mImsCallUT.getState());
        assertEquals(Call.State.DISCONNECTED, mImsCallUT.getState());
        mImsCallUT.onHangupLocal();
        assertEquals(Call.State.DISCONNECTED, mImsCallUT.getState());
    }
    }


    @FlakyTest
    @FlakyTest