summaryrefslogtreecommitdiffstats
path: root/telecomm
diff options
context:
space:
mode:
authorEvan Charlton <evanc@google.com>2014-03-05 08:21:52 -0800
committerEvan Charlton <evanc@google.com>2014-03-05 14:01:52 -0800
commit74f6bf88eb0247b25caa8be9d170be6ba4cf5d28 (patch)
tree6517d714f34331782f2b000191314c35b0ba08f1 /telecomm
parenta50f45405d4937b86db4c482309cbebdd857e348 (diff)
downloadframeworks_base-74f6bf88eb0247b25caa8be9d170be6ba4cf5d28.zip
frameworks_base-74f6bf88eb0247b25caa8be9d170be6ba4cf5d28.tar.gz
frameworks_base-74f6bf88eb0247b25caa8be9d170be6ba4cf5d28.tar.bz2
Add optional data to incoming calls
When a CallService creates an incoming call, allow it to pass a Bundle of arbitrary data along with the intent. This data will be returned to the CallService via setIncomingCallId. This makes it easier for CallServices to match up incoming calls with their IDs. Change-Id: I52e7e1d0788ecd01aa427e76de7ccf4d9b75f1f0
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecomm/CallService.java24
-rw-r--r--telecomm/java/android/telecomm/ICallService.aidl9
-rw-r--r--telecomm/java/android/telecomm/TelecommConstants.java10
3 files changed, 38 insertions, 5 deletions
diff --git a/telecomm/java/android/telecomm/CallService.java b/telecomm/java/android/telecomm/CallService.java
index 0eb96cc..8767ffa 100644
--- a/telecomm/java/android/telecomm/CallService.java
+++ b/telecomm/java/android/telecomm/CallService.java
@@ -18,6 +18,7 @@ package android.telecomm;
import android.app.Service;
import android.content.Intent;
+import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
@@ -63,7 +64,14 @@ public abstract class CallService extends Service {
disconnect((String) msg.obj);
break;
case MSG_SET_INCOMING_CALL_ID:
- setIncomingCallId((String) msg.obj);
+ SomeArgs args = (SomeArgs) msg.obj;
+ try {
+ String callId = (String) args.arg1;
+ Bundle extras = (Bundle) args.arg2;
+ setIncomingCallId(callId, extras);
+ } finally {
+ args.recycle();
+ }
break;
case MSG_ANSWER:
answer((String) msg.obj);
@@ -103,8 +111,11 @@ public abstract class CallService extends Service {
}
@Override
- public void setIncomingCallId(String callId) {
- mMessageHandler.obtainMessage(MSG_SET_INCOMING_CALL_ID, callId).sendToTarget();
+ public void setIncomingCallId(String callId, Bundle extras) {
+ SomeArgs args = SomeArgs.obtain();
+ args.arg1 = callId;
+ args.arg2 = extras;
+ mMessageHandler.obtainMessage(MSG_SET_INCOMING_CALL_ID, args).sendToTarget();
}
@Override
@@ -201,9 +212,14 @@ public abstract class CallService extends Service {
* 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.
*
+ * If a {@link Bundle} was passed (via {@link TelecommConstants#EXTRA_INCOMING_CALL_EXTRAS}) in
+ * with the {@link TelecommConstants#ACTION_INCOMING_CALL} intent, <code>extras</code> will be
+ * populated with this {@link Bundle}. Otherwise, an empty Bundle will be returned.
+ *
* @param callId The ID of the call.
+ * @param extras The optional extras which were passed in with the intent, or an empty Bundle.
*/
- public abstract void setIncomingCallId(String callId);
+ public abstract void setIncomingCallId(String callId, Bundle extras);
/**
* Answers a ringing call identified by callId. Telecomm invokes this method as a result of the
diff --git a/telecomm/java/android/telecomm/ICallService.aidl b/telecomm/java/android/telecomm/ICallService.aidl
index 6f3c4d46..382bdd5 100644
--- a/telecomm/java/android/telecomm/ICallService.aidl
+++ b/telecomm/java/android/telecomm/ICallService.aidl
@@ -16,6 +16,7 @@
package android.telecomm;
+import android.os.Bundle;
import android.telecomm.CallInfo;
import android.telecomm.ICallServiceAdapter;
@@ -81,9 +82,15 @@ oneway interface ICallService {
* 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.
*
+ * As part of the {@link TelecommConstants#ACTION_INCOMING_CALL} Intent, a Bundle of extra
+ * data could be sent via {@link TelecommConstants#EXTRA_INCOMING_CALL_EXTRAS}, which is
+ * returned through this method. If no data was given, an empty Bundle will be returned.
+ *
* @param callId The ID of the call.
+ * @param extras The Bundle of extra information passed via
+ * {@link TelecommConstants#EXTRA_INCOMING_CALL_EXTRAS}.
*/
- void setIncomingCallId(String callId);
+ void setIncomingCallId(String callId, in Bundle extras);
/**
* Answers a ringing call identified by callId. Telecomm invokes this method as a result of the
diff --git a/telecomm/java/android/telecomm/TelecommConstants.java b/telecomm/java/android/telecomm/TelecommConstants.java
index b0651c8..564f0cb 100644
--- a/telecomm/java/android/telecomm/TelecommConstants.java
+++ b/telecomm/java/android/telecomm/TelecommConstants.java
@@ -16,6 +16,8 @@
package android.telecomm;
+import android.os.Bundle;
+
/**
* Defines constants for use with the Telecomm system.
*/
@@ -42,4 +44,12 @@ public final class TelecommConstants {
*/
public static final String EXTRA_CALL_SERVICE_DESCRIPTOR =
"android.intent.extra.CALL_SERVICE_DESCRIPTOR";
+
+ /**
+ * Optional extra for {@link #ACTION_INCOMING_CALL} containing a {@link Bundle} which contains
+ * metadata about the call. This {@link Bundle} will be returned to the {@link CallService} as
+ * part of {@link CallService#setIncomingCallId(String,Bundle)}.
+ */
+ public static final String EXTRA_INCOMING_CALL_EXTRAS =
+ "android.intent.extra.INCOMING_CALL_EXTRAS";
}