Use the new incoming call confirmation APIs.
Update Telecomm and Telecomm test package to use the new
confirm-incoming-call APIs including confirmIncomingCall and
handleConfirmedIncomingCall. Test call service always confirms all
incoming calls.
Also adds a list of unconfirmed incoming calls to the adapter. The
purpose of this is for the adapter to know which incoming call
confirmations to accept and which to ignore.
Change-Id: I914f25c45e5c887ca84d181d3dc173f25577e520
diff --git a/src/com/android/telecomm/CallServiceWrapper.java b/src/com/android/telecomm/CallServiceWrapper.java
index 74277c4..2ff1cfc 100644
--- a/src/com/android/telecomm/CallServiceWrapper.java
+++ b/src/com/android/telecomm/CallServiceWrapper.java
@@ -121,6 +121,32 @@
}
}
+ /** See {@link ICallService#confirmIncomingCall}. */
+ public void confirmIncomingCall(String callId, String callToken) {
+ try {
+ if (mServiceInterface == null) {
+ Log.wtf(TAG, "confirmIncomingCall() invoked while service in unbound.");
+ } else {
+ mAdapter.addUnconfirmedIncomingCallId(callId);
+ mServiceInterface.confirmIncomingCall(callId, callToken);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Failed to confirmIncomingCall for call " + callId, e);
+ mAdapter.removeUnconfirmedIncomingCallId(callId);
+ }
+ }
+
+ /**
+ * Cancels the an incoming call confirmation for the specified call ID.
+ * TODO(santoscordon): This method should be called by IncomingCallManager when the incoming
+ * call confirmation has failed.
+ *
+ * @param callId The ID of the call.
+ */
+ void cancelIncomingCall(String callId) {
+ mAdapter.removeUnconfirmedIncomingCallId(callId);
+ }
+
/** {@inheritDoc} */
@Override protected void setServiceInterface(IBinder binder) {
mServiceInterface = ICallService.Stub.asInterface(binder);