summaryrefslogtreecommitdiffstats
path: root/telecomm
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2014-02-19 01:59:32 -0800
committerSantos Cordon <santoscordon@google.com>2014-02-24 16:02:59 -0800
commitb340c331bca330e9cb60ce6e398b3c014e1a14c7 (patch)
treecabd07dac8762d6da8a26ecf878c75912ed71886 /telecomm
parentfefe41a79916c2a4701828fcba6d7b8fb95d6a02 (diff)
downloadframeworks_base-b340c331bca330e9cb60ce6e398b3c014e1a14c7.zip
frameworks_base-b340c331bca330e9cb60ce6e398b3c014e1a14c7.tar.gz
frameworks_base-b340c331bca330e9cb60ce6e398b3c014e1a14c7.tar.bz2
Adding API support for incoming calls.
Change-Id: I7b1530d13e5adac530c4f451aa2cd97f275f9cae
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecomm/CallService.java63
-rw-r--r--telecomm/java/android/telecomm/CallServiceDescriptor.java3
-rw-r--r--telecomm/java/android/telecomm/ICallService.aidl32
-rw-r--r--telecomm/java/android/telecomm/ICallServiceAdapter.aidl12
4 files changed, 76 insertions, 34 deletions
diff --git a/telecomm/java/android/telecomm/CallService.java b/telecomm/java/android/telecomm/CallService.java
index 9bad3ad..0eb96cc 100644
--- a/telecomm/java/android/telecomm/CallService.java
+++ b/telecomm/java/android/telecomm/CallService.java
@@ -62,11 +62,14 @@ 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);
+ case MSG_SET_INCOMING_CALL_ID:
+ setIncomingCallId((String) msg.obj);
+ break;
+ case MSG_ANSWER:
+ answer((String) msg.obj);
+ break;
+ case MSG_REJECT:
+ reject((String) msg.obj);
break;
default:
break;
@@ -100,11 +103,18 @@ public abstract class CallService extends Service {
}
@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();
+ public void setIncomingCallId(String callId) {
+ mMessageHandler.obtainMessage(MSG_SET_INCOMING_CALL_ID, callId).sendToTarget();
+ }
+
+ @Override
+ public void answer(String callId) {
+ mMessageHandler.obtainMessage(MSG_ANSWER, callId).sendToTarget();
+ }
+
+ @Override
+ public void reject(String callId) {
+ mMessageHandler.obtainMessage(MSG_REJECT, callId).sendToTarget();
}
}
@@ -118,7 +128,9 @@ public abstract class CallService extends Service {
MSG_IS_COMPATIBLE_WITH = 2,
MSG_CALL = 3,
MSG_DISCONNECT = 4,
- MSG_CONFIRM_INCOMING_CALL = 5;
+ MSG_SET_INCOMING_CALL_ID = 5,
+ MSG_ANSWER = 6,
+ MSG_REJECT = 7;
/**
* Message handler for consolidating binder callbacks onto a single thread.
@@ -183,14 +195,29 @@ public abstract class CallService extends Service {
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}.
+ * Receives a new call ID to use with an incoming call. Invoked by Telecomm after it is notified
+ * that this call service has a pending incoming call, see
+ * {@link TelecommConstants#ACTION_INCOMING_CALL}. The call service must first give Telecomm
+ * additional information about the call through {@link ICallServiceAdapter#handleIncomingCall}.
+ * Following that, the call service can update the call at will using the specified call ID.
+ *
+ * @param callId The ID of the call.
+ */
+ public abstract void setIncomingCallId(String callId);
+
+ /**
+ * Answers a ringing call identified by callId. Telecomm invokes this method as a result of the
+ * user hitting the "answer" button in the incoming call screen.
+ *
+ * @param callId The ID of the call.
+ */
+ public abstract void answer(String callId);
+
+ /**
+ * Rejects a ringing call identified by callId. Telecomm invokes this method as a result of the
+ * user hitting the "reject" button in the incoming call screen.
*
* @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);
+ public abstract void reject(String callId);
}
diff --git a/telecomm/java/android/telecomm/CallServiceDescriptor.java b/telecomm/java/android/telecomm/CallServiceDescriptor.java
index 256b558..40f6ab9 100644
--- a/telecomm/java/android/telecomm/CallServiceDescriptor.java
+++ b/telecomm/java/android/telecomm/CallServiceDescriptor.java
@@ -189,7 +189,8 @@ public final class CallServiceDescriptor implements Parcelable {
dest.writeInt(mNetworkType);
}
- static final Creator<CallServiceDescriptor> CREATOR = new Creator<CallServiceDescriptor>() {
+ public static final Creator<CallServiceDescriptor> CREATOR =
+ new Creator<CallServiceDescriptor>() {
@Override
public CallServiceDescriptor createFromParcel(Parcel source) {
String id = source.readString();
diff --git a/telecomm/java/android/telecomm/ICallService.aidl b/telecomm/java/android/telecomm/ICallService.aidl
index 393a1be..6f3c4d46 100644
--- a/telecomm/java/android/telecomm/ICallService.aidl
+++ b/telecomm/java/android/telecomm/ICallService.aidl
@@ -61,8 +61,7 @@ oneway interface ICallService {
* handle-calling systems. See {@link #isCompatibleWith}. It is expected that the
* call service respond via {@link ICallServiceAdapter#handleSuccessfulOutgoingCall} if it can
* successfully make the call.
- * TODO(santoscordon): Figure out how a calls service can short-circuit a failure to
- * the adapter.
+ * TODO(santoscordon): Figure out how a call service can short-circuit a failure to the adapter.
*
* @param callInfo The details of the relevant call.
*/
@@ -76,14 +75,29 @@ oneway interface ICallService {
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}.
+ * Receives a new call ID to use with an incoming call. Invoked by Telecomm after it is notified
+ * that this call service has a pending incoming call, see
+ * {@link TelecommConstants#ACTION_INCOMING_CALL}. The call service must first give Telecomm
+ * additional information of the call through {@link ICallServiceAdapter#handleIncomingCall}.
+ * Following that, the call service can update the call at will using the specified call ID.
*
* @param callId The ID of the call.
- * @param callToken The call token received through the incoming call intent.
*/
- void confirmIncomingCall(String callId, String callToken);
+ void setIncomingCallId(String callId);
+
+ /**
+ * Answers a ringing call identified by callId. Telecomm invokes this method as a result of the
+ * user hitting the "answer" button in the incoming call screen.
+ *
+ * @param callId The ID of the call.
+ */
+ void answer(String callId);
+
+ /**
+ * Rejects a ringing call identified by callId. Telecomm invokes this method as a result of the
+ * user hitting the "reject" button in the incoming call screen.
+ *
+ * @param callId The ID of the call.
+ */
+ void reject(String callId);
}
diff --git a/telecomm/java/android/telecomm/ICallServiceAdapter.aidl b/telecomm/java/android/telecomm/ICallServiceAdapter.aidl
index c1ffa68..2e03d39 100644
--- a/telecomm/java/android/telecomm/ICallServiceAdapter.aidl
+++ b/telecomm/java/android/telecomm/ICallServiceAdapter.aidl
@@ -37,15 +37,15 @@ oneway interface ICallServiceAdapter {
void setCompatibleWith(String callId, boolean isCompatible);
/**
- * 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}.
+ * Provides Telecomm with the details of an incoming call. An invocation of this method must
+ * follow {@link CallService#setIncomingCallId} and use the call ID specified therein. Upon
+ * the invocation of this method, Telecomm will bring up the incoming-call interface where the
+ * user can elect to answer or reject a call.
+ * TODO(santoscordon): Consider renaming from handle* to notify*.
*
* @param callInfo The details of the relevant call.
*/
- void handleConfirmedIncomingCall(in CallInfo callInfo);
+ void handleIncomingCall(in CallInfo callInfo);
/**
* Tells Telecomm that an attempt to place the specified outgoing call succeeded.