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

Commit 4638a75a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "fix CtsVerifier test where call gets stuck"

parents c86ce4d7 8f76baad
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -5435,11 +5435,15 @@ public class CallsManager extends Call.ListenerBase
        @Override
        public void performAction() {
            synchronized (mLock) {
                Log.d(this, "perform set call state for %s, state = %s", mCall, mState);
                Log.d(this, "performAction: current call state %s", mCall);
                if (mCall.getState() != CallState.DISCONNECTED
                        && mCall.getState() != CallState.DISCONNECTING) {
                    Log.d(this, "performAction: setting to new state = %s", mState);
                    setCallState(mCall, mState, mTag);
                }
            }
        }
    }

    private final class ActionUnHoldCall implements PendingAction {
        private final Call mCall;
@@ -5665,4 +5669,14 @@ public class CallsManager extends Call.ListenerBase
    public Ringer getRinger() {
        return mRinger;
    }


    /**
     * This method should only be used for testing.
     */
    @VisibleForTesting
    public void createActionSetCallStateAndPerformAction(Call call, int state, String tag) {
        ActionSetCallState actionSetCallState = new ActionSetCallState(call, state, tag);
        actionSetCallState.performAction();
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -358,9 +358,8 @@ public class ConnectionServiceWrapper extends ServiceBinder implements
                        if (call.isAlive() && !call.isDisconnectHandledViaFuture()) {
                            mCallsManager.markCallAsDisconnected(
                                    call, new DisconnectCause(DisconnectCause.REMOTE));
                        } else {
                            mCallsManager.markCallAsRemoved(call);
                        }
                        mCallsManager.markCallAsRemoved(call);
                    }
                }
            } catch (Throwable t) {
+16 −0
Original line number Diff line number Diff line
@@ -1697,6 +1697,22 @@ public class CallsManagerTest extends TelecomTestCase {
                any(MissedCallNotifier.CallInfo.class));
    }

    @Test
    public void testSetStateOnlyCalledOnce() {
        // GIVEN a new self-managed call
        Call newCall = addSpyCall();
        doReturn(true).when(newCall).isSelfManaged();
        newCall.setState(CallState.DISCONNECTED, "");

        // WHEN ActionSetCallState is given a disconnect call
        assertEquals(CallState.DISCONNECTED, newCall.getState());
        // attempt to set the call active
        mCallsManager.createActionSetCallStateAndPerformAction(newCall, CallState.ACTIVE, "");

        // THEN assert remains disconnected
        assertEquals(CallState.DISCONNECTED, newCall.getState());
    }

    private Call addSpyCall() {
        return addSpyCall(SIM_2_HANDLE, CallState.ACTIVE);
    }