From 140d648611c27ab2c5593c75936c96bca0a780ab Mon Sep 17 00:00:00 2001 From: sqian Date: Wed, 13 Mar 2019 11:56:18 -0700 Subject: [PATCH] API review: Telecom outgoing call Call redirection API Bug: 126360354 Test: Treehugger Change-Id: Id5b0b4aecb33ba4dc9629cc6bd2bb8836aedc653 --- .../telecom/CallRedirectionService.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/telecomm/java/android/telecom/CallRedirectionService.java b/telecomm/java/android/telecom/CallRedirectionService.java index 329911776993a..d521e30252071 100644 --- a/telecomm/java/android/telecom/CallRedirectionService.java +++ b/telecomm/java/android/telecom/CallRedirectionService.java @@ -62,16 +62,20 @@ public abstract class CallRedirectionService extends Service { private ICallRedirectionAdapter mCallRedirectionAdapter; /** - * Telecom calls this method to inform the implemented {@link CallRedirectionService} of - * a new outgoing call which is being placed. Telecom does not request to redirect emergency - * calls and does not request to redirect calls with gateway information. + * Telecom calls this method once upon binding to a {@link CallRedirectionService} to inform + * it of a new outgoing call which is being placed. Telecom does not request to redirect + * emergency calls and does not request to redirect calls with gateway information. * *

Telecom will cancel the call if Telecom does not receive a response in 5 seconds from * the implemented {@link CallRedirectionService} set by users. * *

The implemented {@link CallRedirectionService} can call {@link #placeCallUnmodified()}, * {@link #redirectCall(Uri, PhoneAccountHandle, boolean)}, and {@link #cancelCall()} only - * from here. + * from here. Calls to these methods are assumed by the Telecom framework to be the response + * for the phone call for which {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)} was + * invoked by Telecom. The Telecom framework will only invoke + * {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)} once each time it binds to a + * {@link CallRedirectionService}. * * @param handle the phone number dialed by the user, represented in E.164 format if possible * @param initialPhoneAccount the {@link PhoneAccountHandle} on which the call will be placed. @@ -91,13 +95,15 @@ public abstract class CallRedirectionService extends Service { * no changes are required to the outgoing call, and that the call should be placed as-is. * *

This can only be called from implemented - * {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)}. + * {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)}. The response corresponds to the + * latest request via {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)}. * */ public final void placeCallUnmodified() { try { mCallRedirectionAdapter.placeCallUnmodified(); } catch (RemoteException e) { + e.rethrowAsRuntimeException(); } } @@ -109,7 +115,8 @@ public abstract class CallRedirectionService extends Service { * replies Telecom a handle for an emergency number. * *

This can only be called from implemented - * {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)}. + * {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)}. The response corresponds to the + * latest request via {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)}. * * @param handle the new phone number to dial * @param targetPhoneAccount the {@link PhoneAccountHandle} to use when placing the call. @@ -126,6 +133,7 @@ public abstract class CallRedirectionService extends Service { try { mCallRedirectionAdapter.redirectCall(handle, targetPhoneAccount, confirmFirst); } catch (RemoteException e) { + e.rethrowAsRuntimeException(); } } @@ -135,13 +143,15 @@ public abstract class CallRedirectionService extends Service { * an outgoing call should be canceled entirely. * *

This can only be called from implemented - * {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)}. + * {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)}. The response corresponds to the + * latest request via {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)}. * */ public final void cancelCall() { try { mCallRedirectionAdapter.cancelCall(); } catch (RemoteException e) { + e.rethrowAsRuntimeException(); } }