summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--telecomm/java/android/telecom/CallRedirectionService.java9
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();