Merge "Throw new IllegalStateException in CallRedirectionService when the call redirection is not initialized yet" into sc-dev am: ba314fbb85

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15301694

Change-Id: I1341b9b3e8dcf09cfec276752ec57a4858f01c17
This commit is contained in:
Shuo Qian
2021-07-19 23:07:36 +00:00
committed by Automerger Merge Worker

View File

@@ -100,6 +100,9 @@ public abstract class CallRedirectionService extends Service {
*/ */
public final void placeCallUnmodified() { public final void placeCallUnmodified() {
try { try {
if (mCallRedirectionAdapter == null) {
throw new IllegalStateException("Can only be called from onPlaceCall.");
}
mCallRedirectionAdapter.placeCallUnmodified(); mCallRedirectionAdapter.placeCallUnmodified();
} catch (RemoteException e) { } catch (RemoteException e) {
e.rethrowAsRuntimeException(); e.rethrowAsRuntimeException();
@@ -128,6 +131,9 @@ public abstract class CallRedirectionService extends Service {
@NonNull PhoneAccountHandle targetPhoneAccount, @NonNull PhoneAccountHandle targetPhoneAccount,
boolean confirmFirst) { boolean confirmFirst) {
try { try {
if (mCallRedirectionAdapter == null) {
throw new IllegalStateException("Can only be called from onPlaceCall.");
}
mCallRedirectionAdapter.redirectCall(gatewayUri, targetPhoneAccount, confirmFirst); mCallRedirectionAdapter.redirectCall(gatewayUri, targetPhoneAccount, confirmFirst);
} catch (RemoteException e) { } catch (RemoteException e) {
e.rethrowAsRuntimeException(); e.rethrowAsRuntimeException();
@@ -146,6 +152,9 @@ public abstract class CallRedirectionService extends Service {
*/ */
public final void cancelCall() { public final void cancelCall() {
try { try {
if (mCallRedirectionAdapter == null) {
throw new IllegalStateException("Can only be called from onPlaceCall.");
}
mCallRedirectionAdapter.cancelCall(); mCallRedirectionAdapter.cancelCall();
} catch (RemoteException e) { } catch (RemoteException e) {
e.rethrowAsRuntimeException(); e.rethrowAsRuntimeException();