From 5400101ec6458f0c7337a73e27a81198ae562959 Mon Sep 17 00:00:00 2001 From: Grace Jia Date: Thu, 29 Jul 2021 13:55:40 -0700 Subject: Add new API to notify CallRedirectionService timed out. Currently, CallRedirectionService is unable to know if a call failed due to timeout. Add new API to notify them and call it when Telecom wait too long to complete a call redirection request. Bug: 187346611 Test: CTS test Change-Id: I65aa0a893b3e35a412851ec969f6cdec74af8fab --- .../android/telecom/CallRedirectionService.java | 25 ++++++++++++++++++++++ .../internal/telecom/ICallRedirectionService.aidl | 2 ++ 2 files changed, 27 insertions(+) (limited to 'telecomm/java') diff --git a/telecomm/java/android/telecom/CallRedirectionService.java b/telecomm/java/android/telecom/CallRedirectionService.java index c832f53ae073..8dcae393aba9 100644 --- a/telecomm/java/android/telecom/CallRedirectionService.java +++ b/telecomm/java/android/telecom/CallRedirectionService.java @@ -88,6 +88,13 @@ public abstract class CallRedirectionService extends Service { @NonNull PhoneAccountHandle initialPhoneAccount, boolean allowInteractiveResponse); + /** + * Telecom calls this method when times out waiting for the {@link CallRedirectionService} to + * call {@link #placeCallUnmodified()}, {@link #redirectCall(Uri, PhoneAccountHandle, boolean)}, + * or {@link #cancelCall()} + */ + public void onRedirectionTimeout() {} + /** * The implemented {@link CallRedirectionService} calls this method to response a request * received via {@link #onPlaceCall(Uri, PhoneAccountHandle, boolean)} to inform Telecom that @@ -157,6 +164,12 @@ public abstract class CallRedirectionService extends Service { */ private static final int MSG_PLACE_CALL = 1; + /** + * A handler message to process the attempt to notify the operation of redirection service timed + * out from Telecom + */ + private static final int MSG_TIMEOUT = 2; + /** * A handler to process the attempt to place call with redirection service from Telecom */ @@ -174,6 +187,9 @@ public abstract class CallRedirectionService extends Service { args.recycle(); } break; + case MSG_TIMEOUT: + onRedirectionTimeout(); + break; } } }; @@ -200,6 +216,15 @@ public abstract class CallRedirectionService extends Service { args.arg4 = allowInteractiveResponse; mHandler.obtainMessage(MSG_PLACE_CALL, args).sendToTarget(); } + + /** + * Telecom calls this method to inform the CallRedirectionService of the timeout waiting for + * it to complete its operation. + */ + @Override + public void notifyTimeout() { + mHandler.obtainMessage(MSG_TIMEOUT).sendToTarget(); + } } @Override diff --git a/telecomm/java/com/android/internal/telecom/ICallRedirectionService.aidl b/telecomm/java/com/android/internal/telecom/ICallRedirectionService.aidl index c1bc44007b0b..ce1938b81727 100644 --- a/telecomm/java/com/android/internal/telecom/ICallRedirectionService.aidl +++ b/telecomm/java/com/android/internal/telecom/ICallRedirectionService.aidl @@ -31,4 +31,6 @@ import com.android.internal.telecom.ICallRedirectionAdapter; oneway interface ICallRedirectionService { void placeCall(in ICallRedirectionAdapter adapter, in Uri handle, in PhoneAccountHandle initialPhoneAccount, boolean allowInteractiveResponse); + + void notifyTimeout(); } -- cgit v1.2.3-59-g8ed1b