summaryrefslogtreecommitdiffstats
path: root/telecomm/java/android
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2014-02-14 01:59:01 -0800
committerEvan Charlton <evanc@google.com>2014-02-20 17:07:54 -0800
commitbd63f90a789bfb608dbd036d60c4d08f9fd1f2d9 (patch)
treeec885a31c8abaa59becc46c33473e691232b991b /telecomm/java/android
parentc3010b39c98e2b136c38d68172dbf2dfcbe58c12 (diff)
downloadframeworks_base-bd63f90a789bfb608dbd036d60c4d08f9fd1f2d9.zip
frameworks_base-bd63f90a789bfb608dbd036d60c4d08f9fd1f2d9.tar.gz
frameworks_base-bd63f90a789bfb608dbd036d60c4d08f9fd1f2d9.tar.bz2
New call service methods for incoming calls.
Adds a method that allows Telecomm to request confirmation of an incoming call and another method on the adapter through which the confirmation is sent. Change-Id: Ib5d0a71f40ea3d09a42f31c479c22aed1dbc5ce8
Diffstat (limited to 'telecomm/java/android')
-rw-r--r--telecomm/java/android/telecomm/CallService.java46
-rw-r--r--telecomm/java/android/telecomm/ICallService.aidl12
-rw-r--r--telecomm/java/android/telecomm/ICallServiceAdapter.aidl14
3 files changed, 51 insertions, 21 deletions
diff --git a/telecomm/java/android/telecomm/CallService.java b/telecomm/java/android/telecomm/CallService.java
index d0c4f19..a2fb7eb 100644
--- a/telecomm/java/android/telecomm/CallService.java
+++ b/telecomm/java/android/telecomm/CallService.java
@@ -27,6 +27,8 @@ import android.telecomm.ICallServiceAdapter;
import android.util.Log;
import android.util.Pair;
+import com.android.internal.os.SomeArgs;
+
/**
* Base implementation of CallService which can be used to provide calls for the system
* in-call UI. CallService is a one-way service from the framework's CallsManager to any app
@@ -66,6 +68,12 @@ public abstract class CallService extends Service {
case MSG_DISCONNECT:
disconnect((String) msg.obj);
break;
+ case MSG_CONFIRM_INCOMING_CALL:
+ SomeArgs args = (SomeArgs) msg.obj;
+ String callId = (String) args.arg1;
+ String callToken = (String) args.arg2;
+ confirmIncomingCall(callId, callToken);
+ break;
default:
break;
}
@@ -75,7 +83,7 @@ public abstract class CallService extends Service {
/**
* Default ICallService implementation provided to CallsManager via {@link #onBind}.
*/
- private final class CallServiceWrapper extends ICallService.Stub {
+ private final class CallServiceBinder extends ICallService.Stub {
@Override
public void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter) {
mMessageHandler.obtainMessage(MSG_SET_CALL_SERVICE_ADAPTER, callServiceAdapter)
@@ -96,6 +104,14 @@ public abstract class CallService extends Service {
public void disconnect(String callId) {
mMessageHandler.obtainMessage(MSG_DISCONNECT, callId).sendToTarget();
}
+
+ @Override
+ public void confirmIncomingCall(String callId, String callToken) {
+ SomeArgs args = SomeArgs.obtain();
+ args.arg1 = callId;
+ args.arg2 = callToken;
+ mMessageHandler.obtainMessage(MSG_CONFIRM_INCOMING_CALL, args).sendToTarget();
+ }
}
// Only used internally by this class.
@@ -107,27 +123,19 @@ public abstract class CallService extends Service {
MSG_SET_CALL_SERVICE_ADAPTER = 1,
MSG_IS_COMPATIBLE_WITH = 2,
MSG_CALL = 3,
- MSG_DISCONNECT = 4;
+ MSG_DISCONNECT = 4,
+ MSG_CONFIRM_INCOMING_CALL = 5;
/**
* Message handler for consolidating binder callbacks onto a single thread.
* See {@link #CallServiceMessageHandler}.
*/
- private final CallServiceMessageHandler mMessageHandler;
+ private final CallServiceMessageHandler mMessageHandler = new CallServiceMessageHandler();
/**
* Default binder implementation of {@link ICallService} interface.
*/
- private final CallServiceWrapper mBinder;
-
- /**
- * Protected constructor called only by subclasses creates the binder interface and
- * single-threaded message handler.
- */
- protected CallService() {
- mMessageHandler = new CallServiceMessageHandler();
- mBinder = new CallServiceWrapper();
- }
+ private final CallServiceBinder mBinder = new CallServiceBinder();
/** {@inheritDoc} */
public IBinder onBind(Intent intent) {
@@ -178,4 +186,16 @@ public abstract class CallService extends Service {
* @param callId The ID of the call to disconnect.
*/
public abstract void disconnect(String callId);
+
+ /**
+ * Confirms that the specified incoming call is connecting through this call service. Telecomm
+ * receives all incoming calls initially as intents that include information about a call
+ * and a token identifying the call. Before displaying any UI to the user, Telecomm confirms
+ * the existence of the incoming call by binding to the specified call service and calling
+ * this method. Confirmation responses are received through {@link ICallServiceAdapter}.
+ *
+ * @param callId The ID of the call.
+ * @param callToken The call token received through the incoming call intent.
+ */
+ public abstract void confirmIncomingCall(String callId, String callToken);
}
diff --git a/telecomm/java/android/telecomm/ICallService.aidl b/telecomm/java/android/telecomm/ICallService.aidl
index d9716b5..cfd09c8 100644
--- a/telecomm/java/android/telecomm/ICallService.aidl
+++ b/telecomm/java/android/telecomm/ICallService.aidl
@@ -74,4 +74,16 @@ oneway interface ICallService {
* @param callId The identifier of the call to disconnect.
*/
void disconnect(String callId);
+
+ /**
+ * Confirms that the specified incoming call is connecting through this call service. Telecomm
+ * receives all incoming calls initially as intents that include information about a call
+ * and a token identifying the call. Before displaying any UI to the user, Telecomm confirms
+ * the existence of the incoming call by binding to the specified call service and calling
+ * this method. Confirmation responses are received through {@link ICallServiceAdapter}.
+ *
+ * @param callId The ID of the call.
+ * @param callToken The call token received through the incoming call intent.
+ */
+ void confirmIncomingCall(String callId, String callToken);
}
diff --git a/telecomm/java/android/telecomm/ICallServiceAdapter.aidl b/telecomm/java/android/telecomm/ICallServiceAdapter.aidl
index 2faf30d..c1ffa68 100644
--- a/telecomm/java/android/telecomm/ICallServiceAdapter.aidl
+++ b/telecomm/java/android/telecomm/ICallServiceAdapter.aidl
@@ -25,11 +25,6 @@ import android.telecomm.CallInfo;
oneway interface ICallServiceAdapter {
/**
- * Retrieves a new unique call ID for use with newIncomingCall.
- */
- void getNextCallId(/* TODO(santoscordon): Needs response object */);
-
- /**
* Receives confirmation of a call service's ability to place a call. This method is used in
* response to {@link ICallService#isCompatibleWith}.
* TODO(santoscordon): rename to setIsCompatibleWith().
@@ -42,12 +37,15 @@ oneway interface ICallServiceAdapter {
void setCompatibleWith(String callId, boolean isCompatible);
/**
- * Tells CallsManager of a new incoming call. CallInfo should be populated using a new call ID
- * retrieved via {@link #getNextCallId}.
+ * Receives confirmation of the existence of an incoming call connected through the call
+ * service. Invoked by the call service after it receives a confirmation request from Telecomm
+ * through {@link ICallService#confirmIncomingCall}. The call info object must contain all the
+ * updated status of the call and use the same call ID as was passed into
+ * {@link ICallService#confirmIncomingCall}.
*
* @param callInfo The details of the relevant call.
*/
- void handleIncomingCall(in CallInfo callInfo);
+ void handleConfirmedIncomingCall(in CallInfo callInfo);
/**
* Tells Telecomm that an attempt to place the specified outgoing call succeeded.