Loading src/com/android/server/telecom/Call.java +8 −4 Original line number Diff line number Diff line Loading @@ -2701,7 +2701,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, // hangup, not reject. setOverrideDisconnectCauseCode(new DisconnectCause(DisconnectCause.REJECTED)); if (mTransactionalService != null) { mTransactionalService.onReject(this, DisconnectCause.REJECTED); mTransactionalService.onDisconnect(this, new DisconnectCause(DisconnectCause.REJECTED)); } else if (mConnectionService != null) { mConnectionService.disconnect(this); } else { Loading @@ -2714,7 +2715,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, mVideoStateHistory |= mVideoState; if (mTransactionalService != null) { mTransactionalService.onReject(this, DisconnectCause.REJECTED); mTransactionalService.onDisconnect(this, new DisconnectCause(DisconnectCause.REJECTED)); } else if (mConnectionService != null) { mConnectionService.reject(this, rejectWithMessage, textMessage); } else { Loading @@ -2737,7 +2739,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, // Since its simulated reason we can't pass along the reject reason. setOverrideDisconnectCauseCode(new DisconnectCause(DisconnectCause.REJECTED)); if (mTransactionalService != null) { mTransactionalService.onReject(this, DisconnectCause.REJECTED); mTransactionalService.onDisconnect(this, new DisconnectCause(DisconnectCause.REJECTED)); } else if (mConnectionService != null) { mConnectionService.disconnect(this); } else { Loading @@ -2749,7 +2752,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, // Ensure video state history tracks video state at time of rejection. mVideoStateHistory |= mVideoState; if (mTransactionalService != null) { mTransactionalService.onReject(this, rejectReason); mTransactionalService.onDisconnect(this, new DisconnectCause(DisconnectCause.REJECTED)); } else if (mConnectionService != null) { mConnectionService.rejectWithReason(this, rejectReason); } else { Loading src/com/android/server/telecom/TransactionalServiceWrapper.java +3 −29 Original line number Diff line number Diff line Loading @@ -388,7 +388,7 @@ public class TransactionalServiceWrapper implements Log.i(TAG, String.format(Locale.US, "onSetInactive: callId=[%s]", call.getId())); mTransactionManager.addTransaction( new CallEventCallbackAckTransaction(mICallEventCallback, ON_SET_INACTIVE, call.getId(), 0), new OutcomeReceiver<>() { ON_SET_INACTIVE, call.getId()), new OutcomeReceiver<>() { @Override public void onResult(VoipCallTransactionResult result) { mCallsManager.markCallAsOnHold(call); Loading @@ -411,7 +411,7 @@ public class TransactionalServiceWrapper implements mTransactionManager.addTransaction( new CallEventCallbackAckTransaction(mICallEventCallback, ON_DISCONNECT, call.getId(), 0), new OutcomeReceiver<>() { call.getId(), cause), new OutcomeReceiver<>() { @Override public void onResult(VoipCallTransactionResult result) { removeCallFromCallsManager(call, cause); Loading @@ -428,32 +428,6 @@ public class TransactionalServiceWrapper implements } } public void onReject(Call call, @android.telecom.Call.RejectReason int rejectReason) { try { Log.startSession("TSW.oR"); Log.d(TAG, String.format(Locale.US, "onReject: callId=[%s]", call.getId())); mTransactionManager.addTransaction( new CallEventCallbackAckTransaction(mICallEventCallback, ON_REJECT, call.getId(), 0), new OutcomeReceiver<>() { @Override public void onResult(VoipCallTransactionResult result) { removeCallFromCallsManager(call, new DisconnectCause(DisconnectCause.REJECTED)); } @Override public void onError(CallException exception) { removeCallFromCallsManager(call, new DisconnectCause(DisconnectCause.REJECTED)); } } ); } finally { Log.endSession(); } } public void onCallStreamingStarted(Call call) { try { Log.startSession("TSW.oCSS"); Loading @@ -462,7 +436,7 @@ public class TransactionalServiceWrapper implements mTransactionManager.addTransaction( new CallEventCallbackAckTransaction(mICallEventCallback, ON_STREAMING_STARTED, call.getId(), 0), new OutcomeReceiver<>() { call.getId()), new OutcomeReceiver<>() { @Override public void onResult(VoipCallTransactionResult result) { } Loading src/com/android/server/telecom/voip/CallEventCallbackAckTransaction.java +22 −5 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.telecom.CallException.CODE_OPERATION_TIMED_OUT; import android.os.Bundle; import android.os.RemoteException; import android.os.ResultReceiver; import android.telecom.DisconnectCause; import android.util.Log; import com.android.internal.telecom.ICallEventCallback; Loading @@ -41,7 +42,10 @@ public class CallEventCallbackAckTransaction extends VoipCallTransaction { private final ICallEventCallback mICallEventCallback; private final String mAction; private final String mCallId; private final int mVideoState; // optional values private int mVideoState = 0; private DisconnectCause mDisconnectCause = null; private final VoipCallTransactionResult TRANSACTION_FAILED = new VoipCallTransactionResult( CODE_OPERATION_TIMED_OUT, "failed to complete the operation before timeout"); Loading @@ -61,6 +65,14 @@ public class CallEventCallbackAckTransaction extends VoipCallTransaction { } } public CallEventCallbackAckTransaction(ICallEventCallback service, String action, String callId) { mICallEventCallback = service; mAction = action; mCallId = callId; } public CallEventCallbackAckTransaction(ICallEventCallback service, String action, String callId, int videoState) { mICallEventCallback = service; Loading @@ -69,6 +81,14 @@ public class CallEventCallbackAckTransaction extends VoipCallTransaction { mVideoState = videoState; } public CallEventCallbackAckTransaction(ICallEventCallback service, String action, String callId, DisconnectCause cause) { mICallEventCallback = service; mAction = action; mCallId = callId; mDisconnectCause = cause; } @Override public CompletionStage<VoipCallTransactionResult> processTransaction(Void v) { Loading @@ -82,10 +102,7 @@ public class CallEventCallbackAckTransaction extends VoipCallTransaction { mICallEventCallback.onSetInactive(mCallId, receiver); break; case TransactionalServiceWrapper.ON_DISCONNECT: mICallEventCallback.onDisconnect(mCallId, receiver); break; case TransactionalServiceWrapper.ON_REJECT: mICallEventCallback.onReject(mCallId, receiver); mICallEventCallback.onDisconnect(mCallId, mDisconnectCause, receiver); break; case TransactionalServiceWrapper.ON_SET_ACTIVE: mICallEventCallback.onSetActive(mCallId, receiver); Loading testapps/transactionalVoipApp/src/com/android/server/telecom/transactionalVoipApp/MyVoipCall.java +3 −7 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.telecom.CallControlCallback; import android.telecom.CallEndpoint; import android.telecom.CallControl; import android.telecom.CallEventCallback; import android.telecom.DisconnectCause; import android.util.Log; import java.util.List; Loading Loading @@ -62,13 +63,8 @@ public class MyVoipCall implements CallControlCallback, CallEventCallback { } @Override public void onReject(@NonNull Consumer<Boolean> wasCompleted) { Log.i(TAG, String.format("onReject: callId=[%s]", mCallId)); wasCompleted.accept(Boolean.TRUE); } @Override public void onDisconnect(@NonNull Consumer<Boolean> wasCompleted) { public void onDisconnect(@NonNull DisconnectCause cause, @NonNull Consumer<Boolean> wasCompleted) { Log.i(TAG, String.format("onDisconnect: callId=[%s]", mCallId)); wasCompleted.accept(Boolean.TRUE); } Loading tests/src/com/android/server/telecom/tests/CallTest.java +1 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; Loading Loading @@ -426,11 +427,6 @@ public class CallTest extends TelecomTestCase { call.answer(0); verify(mMockTransactionalService, times(1)).onAnswer(call, 0); // assert CallEventCallback#onReject is called call.setState(CallState.RINGING, "test"); call.reject(0); verify(mMockTransactionalService, times(1)).onReject(call, 0); // assert CallEventCallback#onDisconnect is called call.setState(CallState.ACTIVE, "test"); call.disconnect(); Loading Loading
src/com/android/server/telecom/Call.java +8 −4 Original line number Diff line number Diff line Loading @@ -2701,7 +2701,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, // hangup, not reject. setOverrideDisconnectCauseCode(new DisconnectCause(DisconnectCause.REJECTED)); if (mTransactionalService != null) { mTransactionalService.onReject(this, DisconnectCause.REJECTED); mTransactionalService.onDisconnect(this, new DisconnectCause(DisconnectCause.REJECTED)); } else if (mConnectionService != null) { mConnectionService.disconnect(this); } else { Loading @@ -2714,7 +2715,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, mVideoStateHistory |= mVideoState; if (mTransactionalService != null) { mTransactionalService.onReject(this, DisconnectCause.REJECTED); mTransactionalService.onDisconnect(this, new DisconnectCause(DisconnectCause.REJECTED)); } else if (mConnectionService != null) { mConnectionService.reject(this, rejectWithMessage, textMessage); } else { Loading @@ -2737,7 +2739,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, // Since its simulated reason we can't pass along the reject reason. setOverrideDisconnectCauseCode(new DisconnectCause(DisconnectCause.REJECTED)); if (mTransactionalService != null) { mTransactionalService.onReject(this, DisconnectCause.REJECTED); mTransactionalService.onDisconnect(this, new DisconnectCause(DisconnectCause.REJECTED)); } else if (mConnectionService != null) { mConnectionService.disconnect(this); } else { Loading @@ -2749,7 +2752,8 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable, // Ensure video state history tracks video state at time of rejection. mVideoStateHistory |= mVideoState; if (mTransactionalService != null) { mTransactionalService.onReject(this, rejectReason); mTransactionalService.onDisconnect(this, new DisconnectCause(DisconnectCause.REJECTED)); } else if (mConnectionService != null) { mConnectionService.rejectWithReason(this, rejectReason); } else { Loading
src/com/android/server/telecom/TransactionalServiceWrapper.java +3 −29 Original line number Diff line number Diff line Loading @@ -388,7 +388,7 @@ public class TransactionalServiceWrapper implements Log.i(TAG, String.format(Locale.US, "onSetInactive: callId=[%s]", call.getId())); mTransactionManager.addTransaction( new CallEventCallbackAckTransaction(mICallEventCallback, ON_SET_INACTIVE, call.getId(), 0), new OutcomeReceiver<>() { ON_SET_INACTIVE, call.getId()), new OutcomeReceiver<>() { @Override public void onResult(VoipCallTransactionResult result) { mCallsManager.markCallAsOnHold(call); Loading @@ -411,7 +411,7 @@ public class TransactionalServiceWrapper implements mTransactionManager.addTransaction( new CallEventCallbackAckTransaction(mICallEventCallback, ON_DISCONNECT, call.getId(), 0), new OutcomeReceiver<>() { call.getId(), cause), new OutcomeReceiver<>() { @Override public void onResult(VoipCallTransactionResult result) { removeCallFromCallsManager(call, cause); Loading @@ -428,32 +428,6 @@ public class TransactionalServiceWrapper implements } } public void onReject(Call call, @android.telecom.Call.RejectReason int rejectReason) { try { Log.startSession("TSW.oR"); Log.d(TAG, String.format(Locale.US, "onReject: callId=[%s]", call.getId())); mTransactionManager.addTransaction( new CallEventCallbackAckTransaction(mICallEventCallback, ON_REJECT, call.getId(), 0), new OutcomeReceiver<>() { @Override public void onResult(VoipCallTransactionResult result) { removeCallFromCallsManager(call, new DisconnectCause(DisconnectCause.REJECTED)); } @Override public void onError(CallException exception) { removeCallFromCallsManager(call, new DisconnectCause(DisconnectCause.REJECTED)); } } ); } finally { Log.endSession(); } } public void onCallStreamingStarted(Call call) { try { Log.startSession("TSW.oCSS"); Loading @@ -462,7 +436,7 @@ public class TransactionalServiceWrapper implements mTransactionManager.addTransaction( new CallEventCallbackAckTransaction(mICallEventCallback, ON_STREAMING_STARTED, call.getId(), 0), new OutcomeReceiver<>() { call.getId()), new OutcomeReceiver<>() { @Override public void onResult(VoipCallTransactionResult result) { } Loading
src/com/android/server/telecom/voip/CallEventCallbackAckTransaction.java +22 −5 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static android.telecom.CallException.CODE_OPERATION_TIMED_OUT; import android.os.Bundle; import android.os.RemoteException; import android.os.ResultReceiver; import android.telecom.DisconnectCause; import android.util.Log; import com.android.internal.telecom.ICallEventCallback; Loading @@ -41,7 +42,10 @@ public class CallEventCallbackAckTransaction extends VoipCallTransaction { private final ICallEventCallback mICallEventCallback; private final String mAction; private final String mCallId; private final int mVideoState; // optional values private int mVideoState = 0; private DisconnectCause mDisconnectCause = null; private final VoipCallTransactionResult TRANSACTION_FAILED = new VoipCallTransactionResult( CODE_OPERATION_TIMED_OUT, "failed to complete the operation before timeout"); Loading @@ -61,6 +65,14 @@ public class CallEventCallbackAckTransaction extends VoipCallTransaction { } } public CallEventCallbackAckTransaction(ICallEventCallback service, String action, String callId) { mICallEventCallback = service; mAction = action; mCallId = callId; } public CallEventCallbackAckTransaction(ICallEventCallback service, String action, String callId, int videoState) { mICallEventCallback = service; Loading @@ -69,6 +81,14 @@ public class CallEventCallbackAckTransaction extends VoipCallTransaction { mVideoState = videoState; } public CallEventCallbackAckTransaction(ICallEventCallback service, String action, String callId, DisconnectCause cause) { mICallEventCallback = service; mAction = action; mCallId = callId; mDisconnectCause = cause; } @Override public CompletionStage<VoipCallTransactionResult> processTransaction(Void v) { Loading @@ -82,10 +102,7 @@ public class CallEventCallbackAckTransaction extends VoipCallTransaction { mICallEventCallback.onSetInactive(mCallId, receiver); break; case TransactionalServiceWrapper.ON_DISCONNECT: mICallEventCallback.onDisconnect(mCallId, receiver); break; case TransactionalServiceWrapper.ON_REJECT: mICallEventCallback.onReject(mCallId, receiver); mICallEventCallback.onDisconnect(mCallId, mDisconnectCause, receiver); break; case TransactionalServiceWrapper.ON_SET_ACTIVE: mICallEventCallback.onSetActive(mCallId, receiver); Loading
testapps/transactionalVoipApp/src/com/android/server/telecom/transactionalVoipApp/MyVoipCall.java +3 −7 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.telecom.CallControlCallback; import android.telecom.CallEndpoint; import android.telecom.CallControl; import android.telecom.CallEventCallback; import android.telecom.DisconnectCause; import android.util.Log; import java.util.List; Loading Loading @@ -62,13 +63,8 @@ public class MyVoipCall implements CallControlCallback, CallEventCallback { } @Override public void onReject(@NonNull Consumer<Boolean> wasCompleted) { Log.i(TAG, String.format("onReject: callId=[%s]", mCallId)); wasCompleted.accept(Boolean.TRUE); } @Override public void onDisconnect(@NonNull Consumer<Boolean> wasCompleted) { public void onDisconnect(@NonNull DisconnectCause cause, @NonNull Consumer<Boolean> wasCompleted) { Log.i(TAG, String.format("onDisconnect: callId=[%s]", mCallId)); wasCompleted.accept(Boolean.TRUE); } Loading
tests/src/com/android/server/telecom/tests/CallTest.java +1 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; Loading Loading @@ -426,11 +427,6 @@ public class CallTest extends TelecomTestCase { call.answer(0); verify(mMockTransactionalService, times(1)).onAnswer(call, 0); // assert CallEventCallback#onReject is called call.setState(CallState.RINGING, "test"); call.reject(0); verify(mMockTransactionalService, times(1)).onReject(call, 0); // assert CallEventCallback#onDisconnect is called call.setState(CallState.ACTIVE, "test"); call.disconnect(); Loading