summaryrefslogtreecommitdiff
path: root/telecomm/java/android/telecom/ConnectionServiceAdapter.java
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2016-03-23 16:06:34 -0700
committerTyler Gunn <tgunn@google.com>2016-03-23 16:06:34 -0700
commitdee56a8a79f9daa1e597f5d4f399d3a5feedcac4 (patch)
tree1bdde5cc7cd47822590d5f6ceb515145c6d390aa /telecomm/java/android/telecom/ConnectionServiceAdapter.java
parentfbc98e1c30e9ef6827f0dcd8024b0fd2de28cf33 (diff)
Expand call/connection extras API.
Currently, connection extras are propagated up to Telecom as an entire bundle. This is not ideal, as any time a change is made to the extras, the bundle needs to be fetched, changed, and then re-set on the connection, where it is parceled to Telecom as a whole. Using how extras on an Intent as inspiration, this CL adds separate putExtras, putExtra, and removeExtra methods to allow manipulation of the extras bundle without operating on it in its entirety. This Cl also adds support for Calls modifying the extras bundle, with changes propagated back down to ConnectionServices. Bug: 27458894 Change-Id: I152340a3bca2dc03f170b06b172a6823410fb961
Diffstat (limited to 'telecomm/java/android/telecom/ConnectionServiceAdapter.java')
-rw-r--r--telecomm/java/android/telecom/ConnectionServiceAdapter.java82
1 files changed, 77 insertions, 5 deletions
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
index e91128f1f7bc..81e4c2271c14 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
@@ -398,16 +398,88 @@ final class ConnectionServiceAdapter implements DeathRecipient {
}
/**
- * Sets extras associated with a connection.
+ * Adds some extras associated with a {@code Connection}.
*
* @param callId The unique ID of the call.
- * @param extras The extras to associate with this call.
+ * @param extras The extras to add.
*/
- void setExtras(String callId, Bundle extras) {
- Log.v(this, "setExtras: %s", extras);
+ void putExtras(String callId, Bundle extras) {
+ Log.v(this, "putExtras: %s", callId);
for (IConnectionServiceAdapter adapter : mAdapters) {
try {
- adapter.setExtras(callId, extras);
+ adapter.putExtras(callId, extras);
+ } catch (RemoteException ignored) {
+ }
+ }
+ }
+
+ /**
+ * Adds an extra associated with a {@code Connection}.
+ *
+ * @param callId The unique ID of the call.
+ * @param key The extra key.
+ * @param value The extra value.
+ */
+ void putExtra(String callId, String key, boolean value) {
+ Log.v(this, "putExtra: %s %s=%b", callId, key, value);
+ for (IConnectionServiceAdapter adapter : mAdapters) {
+ try {
+ Bundle bundle = new Bundle();
+ bundle.putBoolean(key, value);
+ adapter.putExtras(callId, bundle);
+ } catch (RemoteException ignored) {
+ }
+ }
+ }
+
+ /**
+ * Adds an extra associated with a {@code Connection}.
+ *
+ * @param callId The unique ID of the call.
+ * @param key The extra key.
+ * @param value The extra value.
+ */
+ void putExtra(String callId, String key, int value) {
+ Log.v(this, "putExtra: %s %s=%d", callId, key, value);
+ for (IConnectionServiceAdapter adapter : mAdapters) {
+ try {
+ Bundle bundle = new Bundle();
+ bundle.putInt(key, value);
+ adapter.putExtras(callId, bundle);
+ } catch (RemoteException ignored) {
+ }
+ }
+ }
+
+ /**
+ * Adds an extra associated with a {@code Connection}.
+ *
+ * @param callId The unique ID of the call.
+ * @param key The extra key.
+ * @param value The extra value.
+ */
+ void putExtra(String callId, String key, String value) {
+ Log.v(this, "putExtra: %s %s=%s", callId, key, value);
+ for (IConnectionServiceAdapter adapter : mAdapters) {
+ try {
+ Bundle bundle = new Bundle();
+ bundle.putString(key, value);
+ adapter.putExtras(callId, bundle);
+ } catch (RemoteException ignored) {
+ }
+ }
+ }
+
+ /**
+ * Removes extras associated with a {@code Connection}.
+ * @param callId The unique ID of the call.
+ * @param keys The extra keys to remove.
+ */
+ void removeExtras(String callId, List<String> keys) {
+ Log.v(this, "removeExtras: %s %s", callId, keys);
+ for (IConnectionServiceAdapter adapter : mAdapters) {
+ try {
+ adapter.removeExtras(callId, keys);
} catch (RemoteException ignored) {
}
}