Loading src/com/android/server/telecom/TransactionalServiceWrapper.java +10 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.telecom.CallStreamingService; import android.telecom.DisconnectCause; import android.telecom.Log; import android.telecom.PhoneAccountHandle; import android.text.TextUtils; import androidx.annotation.VisibleForTesting; Loading Loading @@ -250,8 +251,15 @@ public class TransactionalServiceWrapper implements break; } } else { Log.i(TAG, action + ": mCallsManager does not contain call with id=" + callId); callback.send(CODE_CALL_IS_NOT_BEING_TRACKED, new Bundle()); Bundle exceptionBundle = new Bundle(); exceptionBundle.putParcelable(TRANSACTION_EXCEPTION_KEY, new CallException(TextUtils.formatSimple( "Telecom cannot process [%s] because the call with id=[%s] is no longer " + "being tracked. This is most likely a result of the call " + "already being disconnected and removed. Try re-adding the call" + " via TelecomManager#addCall", action, callId), CODE_CALL_IS_NOT_BEING_TRACKED)); callback.send(CODE_CALL_IS_NOT_BEING_TRACKED, exceptionBundle); } } Loading src/com/android/server/telecom/voip/HoldActiveCallForNewCallTransaction.java +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ public class HoldActiveCallForNewCallTransaction extends VoipCallTransaction { public void onError(CallException exception) { Log.d(TAG, "processTransaction: onError"); future.complete(new VoipCallTransactionResult( VoipCallTransactionResult.RESULT_FAILED, null)); exception.getCode(), exception.getMessage())); } }); Loading src/com/android/server/telecom/voip/HoldCallTransaction.java +13 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.telecom.voip; import android.telecom.CallException; import android.util.Log; import com.android.server.telecom.Call; Loading @@ -38,11 +39,17 @@ public class HoldCallTransaction extends VoipCallTransaction { @Override public CompletionStage<VoipCallTransactionResult> processTransaction(Void v) { Log.d(TAG, "processTransaction"); CompletableFuture<VoipCallTransactionResult> future = new CompletableFuture<>(); if (mCallsManager.canHold(mCall)) { mCallsManager.markCallAsOnHold(mCall); return CompletableFuture.completedFuture( new VoipCallTransactionResult(VoipCallTransactionResult.RESULT_SUCCEED, "holdCallTransaction complete")); future.complete(new VoipCallTransactionResult( VoipCallTransactionResult.RESULT_SUCCEED, null)); } else { Log.d(TAG, "processTransaction: onError"); future.complete(new VoipCallTransactionResult( CallException.CODE_CANNOT_HOLD_CURRENT_ACTIVE_CALL, "cannot hold call")); } return future; } } src/com/android/server/telecom/voip/RequestFocusTransaction.java +1 −2 Original line number Diff line number Diff line Loading @@ -53,9 +53,8 @@ public class RequestFocusTransaction extends VoipCallTransaction { @Override public void onError(CallException exception) { Log.d(TAG, "processTransaction: onError"); future.complete(new VoipCallTransactionResult( VoipCallTransactionResult.RESULT_FAILED, null)); exception.getCode(), exception.getMessage())); } }); Loading tests/src/com/android/server/telecom/tests/CallExceptionTests.java +3 −10 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.telecom.tests; import static android.telecom.CallException.CODE_CALL_CANNOT_BE_SET_TO_ACTIVE; import static android.telecom.CallException.CODE_ERROR_UNKNOWN; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.times; Loading Loading @@ -50,14 +51,6 @@ public class CallExceptionTests extends TelecomTestCase { super.tearDown(); } @Test public void testSimpleException() { String message = "test message"; CallException exception = new CallException(message); assertTrue(exception.getMessage().contains(message)); assertEquals(CallException.CODE_ERROR_UNKNOWN, exception.getCode()); } @Test public void testExceptionWithCode() { String message = "test message"; Loading @@ -69,7 +62,7 @@ public class CallExceptionTests extends TelecomTestCase { @Test public void testDescribeContents() { String message = "test message"; CallException exception = new CallException(message); CallException exception = new CallException(message, CODE_ERROR_UNKNOWN); assertEquals(0, exception.describeContents()); } Loading @@ -77,7 +70,7 @@ public class CallExceptionTests extends TelecomTestCase { public void testWriteToParcel() { // GIVEN String message = "test message"; CallException exception = new CallException(message); CallException exception = new CallException(message, CODE_ERROR_UNKNOWN); // WHEN exception.writeToParcel(mParcel, 0); Loading Loading
src/com/android/server/telecom/TransactionalServiceWrapper.java +10 −2 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import android.telecom.CallStreamingService; import android.telecom.DisconnectCause; import android.telecom.Log; import android.telecom.PhoneAccountHandle; import android.text.TextUtils; import androidx.annotation.VisibleForTesting; Loading Loading @@ -250,8 +251,15 @@ public class TransactionalServiceWrapper implements break; } } else { Log.i(TAG, action + ": mCallsManager does not contain call with id=" + callId); callback.send(CODE_CALL_IS_NOT_BEING_TRACKED, new Bundle()); Bundle exceptionBundle = new Bundle(); exceptionBundle.putParcelable(TRANSACTION_EXCEPTION_KEY, new CallException(TextUtils.formatSimple( "Telecom cannot process [%s] because the call with id=[%s] is no longer " + "being tracked. This is most likely a result of the call " + "already being disconnected and removed. Try re-adding the call" + " via TelecomManager#addCall", action, callId), CODE_CALL_IS_NOT_BEING_TRACKED)); callback.send(CODE_CALL_IS_NOT_BEING_TRACKED, exceptionBundle); } } Loading
src/com/android/server/telecom/voip/HoldActiveCallForNewCallTransaction.java +1 −1 Original line number Diff line number Diff line Loading @@ -54,7 +54,7 @@ public class HoldActiveCallForNewCallTransaction extends VoipCallTransaction { public void onError(CallException exception) { Log.d(TAG, "processTransaction: onError"); future.complete(new VoipCallTransactionResult( VoipCallTransactionResult.RESULT_FAILED, null)); exception.getCode(), exception.getMessage())); } }); Loading
src/com/android/server/telecom/voip/HoldCallTransaction.java +13 −6 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.telecom.voip; import android.telecom.CallException; import android.util.Log; import com.android.server.telecom.Call; Loading @@ -38,11 +39,17 @@ public class HoldCallTransaction extends VoipCallTransaction { @Override public CompletionStage<VoipCallTransactionResult> processTransaction(Void v) { Log.d(TAG, "processTransaction"); CompletableFuture<VoipCallTransactionResult> future = new CompletableFuture<>(); if (mCallsManager.canHold(mCall)) { mCallsManager.markCallAsOnHold(mCall); return CompletableFuture.completedFuture( new VoipCallTransactionResult(VoipCallTransactionResult.RESULT_SUCCEED, "holdCallTransaction complete")); future.complete(new VoipCallTransactionResult( VoipCallTransactionResult.RESULT_SUCCEED, null)); } else { Log.d(TAG, "processTransaction: onError"); future.complete(new VoipCallTransactionResult( CallException.CODE_CANNOT_HOLD_CURRENT_ACTIVE_CALL, "cannot hold call")); } return future; } }
src/com/android/server/telecom/voip/RequestFocusTransaction.java +1 −2 Original line number Diff line number Diff line Loading @@ -53,9 +53,8 @@ public class RequestFocusTransaction extends VoipCallTransaction { @Override public void onError(CallException exception) { Log.d(TAG, "processTransaction: onError"); future.complete(new VoipCallTransactionResult( VoipCallTransactionResult.RESULT_FAILED, null)); exception.getCode(), exception.getMessage())); } }); Loading
tests/src/com/android/server/telecom/tests/CallExceptionTests.java +3 −10 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.telecom.tests; import static android.telecom.CallException.CODE_CALL_CANNOT_BE_SET_TO_ACTIVE; import static android.telecom.CallException.CODE_ERROR_UNKNOWN; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.times; Loading Loading @@ -50,14 +51,6 @@ public class CallExceptionTests extends TelecomTestCase { super.tearDown(); } @Test public void testSimpleException() { String message = "test message"; CallException exception = new CallException(message); assertTrue(exception.getMessage().contains(message)); assertEquals(CallException.CODE_ERROR_UNKNOWN, exception.getCode()); } @Test public void testExceptionWithCode() { String message = "test message"; Loading @@ -69,7 +62,7 @@ public class CallExceptionTests extends TelecomTestCase { @Test public void testDescribeContents() { String message = "test message"; CallException exception = new CallException(message); CallException exception = new CallException(message, CODE_ERROR_UNKNOWN); assertEquals(0, exception.describeContents()); } Loading @@ -77,7 +70,7 @@ public class CallExceptionTests extends TelecomTestCase { public void testWriteToParcel() { // GIVEN String message = "test message"; CallException exception = new CallException(message); CallException exception = new CallException(message, CODE_ERROR_UNKNOWN); // WHEN exception.writeToParcel(mParcel, 0); Loading