diff options
author | Shuo Qian <shuoq@google.com> | 2021-07-15 10:31:11 -0700 |
---|---|---|
committer | Shuo Qian <shuoq@google.com> | 2021-07-16 20:18:21 +0000 |
commit | f5f508c01d8c8d3ac874977228e15c7945c545ee (patch) | |
tree | 4d850819184b2fa5bbb839a5741f8f3d5c0b5497 /telecomm | |
parent | 4b939ccd2f0b0866f7122117c83fedf77e8180fd (diff) |
Throw new IllegalStateException in CallRedirectionService when the call redirection is not initialized yet
Test: Build
Bug: 193482535
Change-Id: I3609362043684249b6d6981fc7d2ab42c676db76
Diffstat (limited to 'telecomm')
-rw-r--r-- | telecomm/java/android/telecom/CallRedirectionService.java | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/telecomm/java/android/telecom/CallRedirectionService.java b/telecomm/java/android/telecom/CallRedirectionService.java index c832f53ae073..402b70b63204 100644 --- a/telecomm/java/android/telecom/CallRedirectionService.java +++ b/telecomm/java/android/telecom/CallRedirectionService.java @@ -100,6 +100,9 @@ public abstract class CallRedirectionService extends Service { */ public final void placeCallUnmodified() { try { + if (mCallRedirectionAdapter == null) { + throw new IllegalStateException("Can only be called from onPlaceCall."); + } mCallRedirectionAdapter.placeCallUnmodified(); } catch (RemoteException e) { e.rethrowAsRuntimeException(); @@ -128,6 +131,9 @@ public abstract class CallRedirectionService extends Service { @NonNull PhoneAccountHandle targetPhoneAccount, boolean confirmFirst) { try { + if (mCallRedirectionAdapter == null) { + throw new IllegalStateException("Can only be called from onPlaceCall."); + } mCallRedirectionAdapter.redirectCall(gatewayUri, targetPhoneAccount, confirmFirst); } catch (RemoteException e) { e.rethrowAsRuntimeException(); @@ -146,6 +152,9 @@ public abstract class CallRedirectionService extends Service { */ public final void cancelCall() { try { + if (mCallRedirectionAdapter == null) { + throw new IllegalStateException("Can only be called from onPlaceCall."); + } mCallRedirectionAdapter.cancelCall(); } catch (RemoteException e) { e.rethrowAsRuntimeException(); |