summaryrefslogtreecommitdiffstats
path: root/telecomm
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2015-05-27 17:21:45 -0700
committerSantos Cordon <santoscordon@google.com>2015-05-28 09:43:00 -0700
commit6b7f955c2d9b231660b8c54f8ef8e8e6ad802625 (patch)
treec594cb452d2bb826d4a7c502b2ca857a81492e90 /telecomm
parent6ffab1bd65d2b5cc9e2944712058cb42babaa76b (diff)
downloadframeworks_base-6b7f955c2d9b231660b8c54f8ef8e8e6ad802625.zip
frameworks_base-6b7f955c2d9b231660b8c54f8ef8e8e6ad802625.tar.gz
frameworks_base-6b7f955c2d9b231660b8c54f8ef8e8e6ad802625.tar.bz2
Add extras to Connections/Calls. (1/3)
Two major changes: 1) Add the notion of extras to a Connection. These extras will be parceled through to InCallService as Call.getExtras() 2) The previously existing Call.getExtras() has been renamed to getIntentExtras(). This name better describes the fact that these particular extras are from the original CALL or INCOMING_CALL intents. Change-Id: I08c1baf4f08d54757f98012f0c08b423a707c53d
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecom/Call.java23
-rw-r--r--telecomm/java/android/telecom/Conference.java25
-rw-r--r--telecomm/java/android/telecom/Connection.java26
-rw-r--r--telecomm/java/android/telecom/ConnectionService.java24
-rw-r--r--telecomm/java/android/telecom/ConnectionServiceAdapter.java17
-rw-r--r--telecomm/java/android/telecom/ConnectionServiceAdapterServant.java18
-rw-r--r--telecomm/java/android/telecom/ParcelableCall.java21
-rw-r--r--telecomm/java/android/telecom/ParcelableConference.java14
-rw-r--r--telecomm/java/android/telecom/ParcelableConnection.java21
-rw-r--r--telecomm/java/android/telecom/RemoteConference.java28
-rw-r--r--telecomm/java/android/telecom/RemoteConnection.java37
-rw-r--r--telecomm/java/android/telecom/RemoteConnectionService.java12
-rw-r--r--telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl3
13 files changed, 251 insertions, 18 deletions
diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java
index d74c61c..a2e0706 100644
--- a/telecomm/java/android/telecom/Call.java
+++ b/telecomm/java/android/telecom/Call.java
@@ -253,6 +253,7 @@ public final class Call {
private final int mVideoState;
private final StatusHints mStatusHints;
private final Bundle mExtras;
+ private final Bundle mIntentExtras;
/**
* Whether the supplied capabilities supports the specified capability.
@@ -480,12 +481,19 @@ public final class Call {
}
/**
- * @return A bundle extras to pass with the call
+ * @return The extras associated with this call.
*/
public Bundle getExtras() {
return mExtras;
}
+ /**
+ * @return The extras used with the original intent to place this call.
+ */
+ public Bundle getIntentExtras() {
+ return mIntentExtras;
+ }
+
@Override
public boolean equals(Object o) {
if (o instanceof Details) {
@@ -504,7 +512,8 @@ public final class Call {
Objects.equals(mGatewayInfo, d.mGatewayInfo) &&
Objects.equals(mVideoState, d.mVideoState) &&
Objects.equals(mStatusHints, d.mStatusHints) &&
- Objects.equals(mExtras, d.mExtras);
+ Objects.equals(mExtras, d.mExtras) &&
+ Objects.equals(mIntentExtras, d.mIntentExtras);
}
return false;
}
@@ -524,7 +533,8 @@ public final class Call {
Objects.hashCode(mGatewayInfo) +
Objects.hashCode(mVideoState) +
Objects.hashCode(mStatusHints) +
- Objects.hashCode(mExtras);
+ Objects.hashCode(mExtras) +
+ Objects.hashCode(mIntentExtras);
}
/** {@hide} */
@@ -541,7 +551,8 @@ public final class Call {
GatewayInfo gatewayInfo,
int videoState,
StatusHints statusHints,
- Bundle extras) {
+ Bundle extras,
+ Bundle intentExtras) {
mHandle = handle;
mHandlePresentation = handlePresentation;
mCallerDisplayName = callerDisplayName;
@@ -555,6 +566,7 @@ public final class Call {
mVideoState = videoState;
mStatusHints = statusHints;
mExtras = extras;
+ mIntentExtras = intentExtras;
}
}
@@ -986,7 +998,8 @@ public final class Call {
parcelableCall.getGatewayInfo(),
parcelableCall.getVideoState(),
parcelableCall.getStatusHints(),
- parcelableCall.getExtras());
+ parcelableCall.getExtras(),
+ parcelableCall.getIntentExtras());
boolean detailsChanged = !Objects.equals(mDetails, details);
if (detailsChanged) {
mDetails = details;
diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java
index dfbb67a..9db0b92 100644
--- a/telecomm/java/android/telecom/Conference.java
+++ b/telecomm/java/android/telecom/Conference.java
@@ -16,7 +16,9 @@
package android.telecom;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
+import android.os.Bundle;
import android.telecom.Connection.VideoProvider;
import java.util.ArrayList;
@@ -52,6 +54,7 @@ public abstract class Conference extends Conferenceable {
public void onVideoStateChanged(Conference c, int videoState) { }
public void onVideoProviderChanged(Conference c, Connection.VideoProvider videoProvider) {}
public void onStatusHintsChanged(Conference conference, StatusHints statusHints) {}
+ public void onExtrasChanged(Conference conference, Bundle extras) {}
}
private final Set<Listener> mListeners = new CopyOnWriteArraySet<>();
@@ -70,6 +73,7 @@ public abstract class Conference extends Conferenceable {
private String mDisconnectMessage;
private long mConnectTimeMillis = CONNECT_TIME_NOT_SPECIFIED;
private StatusHints mStatusHints;
+ private Bundle mExtras;
private final Connection.Listener mConnectionDeathListener = new Connection.Listener() {
@Override
@@ -600,4 +604,25 @@ public abstract class Conference extends Conferenceable {
public final StatusHints getStatusHints() {
return mStatusHints;
}
+
+ /**
+ * Set some extras that can be associated with this {@code Conference}. No assumptions should
+ * be made as to how an In-Call UI or service will handle these extras.
+ * Keys should be fully qualified (e.g., com.example.MY_EXTRA) to avoid conflicts.
+ *
+ * @param extras The extras associated with this {@code Connection}.
+ */
+ public final void setExtras(@Nullable Bundle extras) {
+ mExtras = extras;
+ for (Listener l : mListeners) {
+ l.onExtrasChanged(this, extras);
+ }
+ }
+
+ /**
+ * @return The extras associated with this conference.
+ */
+ public final Bundle getExtras() {
+ return mExtras;
+ }
}
diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java
index fba4e6a..f9e48b6 100644
--- a/telecomm/java/android/telecom/Connection.java
+++ b/telecomm/java/android/telecom/Connection.java
@@ -20,8 +20,10 @@ import com.android.internal.os.SomeArgs;
import com.android.internal.telecom.IVideoCallback;
import com.android.internal.telecom.IVideoProvider;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.net.Uri;
+import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
@@ -334,6 +336,7 @@ public abstract class Connection extends Conferenceable {
List<ConferenceParticipant> participants) {}
public void onConferenceStarted() {}
public void onConferenceMergeFailed(Connection c) {}
+ public void onExtrasChanged(Connection c, Bundle extras) {}
}
public static abstract class VideoProvider {
@@ -832,6 +835,7 @@ public abstract class Connection extends Conferenceable {
private DisconnectCause mDisconnectCause;
private Conference mConference;
private ConnectionService mConnectionService;
+ private Bundle mExtras;
/**
* Create a new Connection.
@@ -942,6 +946,13 @@ public abstract class Connection extends Conferenceable {
}
/**
+ * @return The extras associated with this connection.
+ */
+ public final Bundle getExtras() {
+ return mExtras;
+ }
+
+ /**
* Assign a listener to be notified of state changes.
*
* @param l A listener.
@@ -1371,6 +1382,21 @@ public abstract class Connection extends Conferenceable {
}
/**
+ * Set some extras that can be associated with this {@code Connection}. No assumptions should
+ * be made as to how an In-Call UI or service will handle these extras.
+ * Keys should be fully qualified (e.g., com.example.MY_EXTRA) to avoid conflicts.
+ *
+ * @param extras The extras associated with this {@code Connection}.
+ */
+ public final void setExtras(@Nullable Bundle extras) {
+ checkImmutable();
+ mExtras = extras;
+ for (Listener l : mListeners) {
+ l.onExtrasChanged(this, extras);
+ }
+ }
+
+ /**
* Notifies this Connection that the {@link #getAudioState()} property has a new value.
*
* @param state The new connection audio state.
diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java
index 199100b..1e8ae88 100644
--- a/telecomm/java/android/telecom/ConnectionService.java
+++ b/telecomm/java/android/telecom/ConnectionService.java
@@ -21,6 +21,7 @@ import android.app.Service;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
+import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
@@ -432,6 +433,12 @@ public abstract class ConnectionService extends Service {
String id = mIdByConference.get(conference);
mAdapter.setStatusHints(id, statusHints);
}
+
+ @Override
+ public void onExtrasChanged(Conference conference, Bundle extras) {
+ String id = mIdByConference.get(conference);
+ mAdapter.setExtras(id, extras);
+ }
};
private final Connection.Listener mConnectionListener = new Connection.Listener() {
@@ -569,6 +576,14 @@ public abstract class ConnectionService extends Service {
mAdapter.onConferenceMergeFailed(id);
}
}
+
+ @Override
+ public void onExtrasChanged(Connection connection, Bundle extras) {
+ String id = mIdByConnection.get(connection);
+ if (id != null) {
+ mAdapter.setExtras(id, extras);
+ }
+ }
};
/** {@inheritDoc} */
@@ -638,7 +653,8 @@ public abstract class ConnectionService extends Service {
connection.getAudioModeIsVoip(),
connection.getStatusHints(),
connection.getDisconnectCause(),
- createIdList(connection.getConferenceables())));
+ createIdList(connection.getConferenceables()),
+ connection.getExtras()));
}
private void abort(String callId) {
@@ -919,7 +935,8 @@ public abstract class ConnectionService extends Service {
null : conference.getVideoProvider().getInterface(),
conference.getVideoState(),
conference.getConnectTimeMillis(),
- conference.getStatusHints());
+ conference.getStatusHints(),
+ conference.getExtras());
mAdapter.addConferenceCall(id, parcelableConference);
mAdapter.setVideoProvider(id, conference.getVideoProvider());
@@ -964,7 +981,8 @@ public abstract class ConnectionService extends Service {
connection.getAudioModeIsVoip(),
connection.getStatusHints(),
connection.getDisconnectCause(),
- emptyList);
+ emptyList,
+ connection.getExtras());
mAdapter.addExistingConnection(id, parcelableConnection);
}
}
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapter.java b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
index a87dbe7..1cb042c 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapter.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapter.java
@@ -17,6 +17,7 @@
package android.telecom;
import android.net.Uri;
+import android.os.Bundle;
import android.os.IBinder.DeathRecipient;
import android.os.RemoteException;
@@ -384,4 +385,20 @@ final class ConnectionServiceAdapter implements DeathRecipient {
}
}
}
+
+ /**
+ * Sets extras associated with a connection.
+ *
+ * @param callId The unique ID of the call.
+ * @param extras The extras to associate with this call.
+ */
+ void setExtras(String callId, Bundle extras) {
+ Log.v(this, "setExtras: %s", extras);
+ for (IConnectionServiceAdapter adapter : mAdapters) {
+ try {
+ adapter.setExtras(callId, extras);
+ } catch (RemoteException ignored) {
+ }
+ }
+ }
}
diff --git a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
index db815ba..293dc11 100644
--- a/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
+++ b/telecomm/java/android/telecom/ConnectionServiceAdapterServant.java
@@ -17,6 +17,7 @@
package android.telecom;
import android.net.Uri;
+import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.RemoteException;
@@ -60,6 +61,7 @@ final class ConnectionServiceAdapterServant {
private static final int MSG_ADD_EXISTING_CONNECTION = 21;
private static final int MSG_ON_POST_DIAL_CHAR = 22;
private static final int MSG_SET_CONFERENCE_MERGE_FAILED = 23;
+ private static final int MSG_SET_EXTRAS = 24;
private final IConnectionServiceAdapter mDelegate;
@@ -230,6 +232,14 @@ final class ConnectionServiceAdapterServant {
}
break;
}
+ case MSG_SET_EXTRAS: {
+ SomeArgs args = (SomeArgs) msg.obj;
+ try {
+ mDelegate.setExtras((String) args.arg1, (Bundle) args.arg2);
+ } finally {
+ args.recycle();
+ }
+ }
}
}
};
@@ -401,6 +411,14 @@ final class ConnectionServiceAdapterServant {
args.arg2 = connection;
mHandler.obtainMessage(MSG_ADD_EXISTING_CONNECTION, args).sendToTarget();
}
+
+ @Override
+ public final void setExtras(String connectionId, Bundle extras) {
+ SomeArgs args = SomeArgs.obtain();
+ args.arg1 = connectionId;
+ args.arg2 = extras;
+ mHandler.obtainMessage(MSG_SET_EXTRAS, args).sendToTarget();
+ }
};
public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
diff --git a/telecomm/java/android/telecom/ParcelableCall.java b/telecomm/java/android/telecom/ParcelableCall.java
index bb65ce9..8cf4aeb 100644
--- a/telecomm/java/android/telecom/ParcelableCall.java
+++ b/telecomm/java/android/telecom/ParcelableCall.java
@@ -54,6 +54,7 @@ public final class ParcelableCall implements Parcelable {
private final StatusHints mStatusHints;
private final int mVideoState;
private final List<String> mConferenceableCallIds;
+ private final Bundle mIntentExtras;
private final Bundle mExtras;
public ParcelableCall(
@@ -77,6 +78,7 @@ public final class ParcelableCall implements Parcelable {
StatusHints statusHints,
int videoState,
List<String> conferenceableCallIds,
+ Bundle intentExtras,
Bundle extras) {
mId = id;
mState = state;
@@ -98,6 +100,7 @@ public final class ParcelableCall implements Parcelable {
mStatusHints = statusHints;
mVideoState = videoState;
mConferenceableCallIds = Collections.unmodifiableList(conferenceableCallIds);
+ mIntentExtras = intentExtras;
mExtras = extras;
}
@@ -227,7 +230,7 @@ public final class ParcelableCall implements Parcelable {
}
/**
- * Any extras to pass with the call
+ * Any extras associated with this call.
*
* @return a bundle of extras
*/
@@ -236,6 +239,15 @@ public final class ParcelableCall implements Parcelable {
}
/**
+ * Extras passed in as part of the original call intent.
+ *
+ * @return The intent extras.
+ */
+ public Bundle getIntentExtras() {
+ return mIntentExtras;
+ }
+
+ /**
* Indicates to the receiver of the {@link ParcelableCall} whether a change has occurred in the
* {@link android.telecom.InCallService.VideoCall} associated with this call. Since
* {@link #getVideoCall()} creates a new {@link VideoCallImpl}, it is useful to know whether
@@ -277,7 +289,8 @@ public final class ParcelableCall implements Parcelable {
int videoState = source.readInt();
List<String> conferenceableCallIds = new ArrayList<>();
source.readList(conferenceableCallIds, classLoader);
- Bundle extras = source.readParcelable(classLoader);
+ Bundle intentExtras = source.readBundle(classLoader);
+ Bundle extras = source.readBundle(classLoader);
return new ParcelableCall(
id,
state,
@@ -299,6 +312,7 @@ public final class ParcelableCall implements Parcelable {
statusHints,
videoState,
conferenceableCallIds,
+ intentExtras,
extras);
}
@@ -338,7 +352,8 @@ public final class ParcelableCall implements Parcelable {
destination.writeParcelable(mStatusHints, 0);
destination.writeInt(mVideoState);
destination.writeList(mConferenceableCallIds);
- destination.writeParcelable(mExtras, 0);
+ destination.writeBundle(mIntentExtras);
+ destination.writeBundle(mExtras);
}
@Override
diff --git a/telecomm/java/android/telecom/ParcelableConference.java b/telecomm/java/android/telecom/ParcelableConference.java
index 3d0c558..870f5ee 100644
--- a/telecomm/java/android/telecom/ParcelableConference.java
+++ b/telecomm/java/android/telecom/ParcelableConference.java
@@ -16,6 +16,7 @@
package android.telecom;
+import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
@@ -38,6 +39,7 @@ public final class ParcelableConference implements Parcelable {
private final IVideoProvider mVideoProvider;
private final int mVideoState;
private StatusHints mStatusHints;
+ private Bundle mExtras;
public ParcelableConference(
PhoneAccountHandle phoneAccount,
@@ -47,7 +49,8 @@ public final class ParcelableConference implements Parcelable {
IVideoProvider videoProvider,
int videoState,
long connectTimeMillis,
- StatusHints statusHints) {
+ StatusHints statusHints,
+ Bundle extras) {
mPhoneAccount = phoneAccount;
mState = state;
mConnectionCapabilities = connectionCapabilities;
@@ -57,6 +60,7 @@ public final class ParcelableConference implements Parcelable {
mVideoState = videoState;
mConnectTimeMillis = connectTimeMillis;
mStatusHints = statusHints;
+ mExtras = extras;
}
@Override
@@ -110,6 +114,10 @@ public final class ParcelableConference implements Parcelable {
return mStatusHints;
}
+ public Bundle getExtras() {
+ return mExtras;
+ }
+
public static final Parcelable.Creator<ParcelableConference> CREATOR =
new Parcelable.Creator<ParcelableConference> () {
@Override
@@ -125,9 +133,10 @@ public final class ParcelableConference implements Parcelable {
IVideoProvider.Stub.asInterface(source.readStrongBinder());
int videoState = source.readInt();
StatusHints statusHints = source.readParcelable(classLoader);
+ Bundle extras = source.readBundle(classLoader);
return new ParcelableConference(phoneAccount, state, capabilities, connectionIds,
- videoCallProvider, videoState, connectTimeMillis, statusHints);
+ videoCallProvider, videoState, connectTimeMillis, statusHints, extras);
}
@Override
@@ -154,5 +163,6 @@ public final class ParcelableConference implements Parcelable {
mVideoProvider != null ? mVideoProvider.asBinder() : null);
destination.writeInt(mVideoState);
destination.writeParcelable(mStatusHints, 0);
+ destination.writeBundle(mExtras);
}
}
diff --git a/telecomm/java/android/telecom/ParcelableConnection.java b/telecomm/java/android/telecom/ParcelableConnection.java
index 552e250..683ab6a 100644
--- a/telecomm/java/android/telecom/ParcelableConnection.java
+++ b/telecomm/java/android/telecom/ParcelableConnection.java
@@ -17,6 +17,7 @@
package android.telecom;
import android.net.Uri;
+import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
@@ -46,6 +47,7 @@ public final class ParcelableConnection implements Parcelable {
private final StatusHints mStatusHints;
private final DisconnectCause mDisconnectCause;
private final List<String> mConferenceableConnectionIds;
+ private final Bundle mExtras;
/** @hide */
public ParcelableConnection(
@@ -62,7 +64,8 @@ public final class ParcelableConnection implements Parcelable {
boolean isVoipAudioMode,
StatusHints statusHints,
DisconnectCause disconnectCause,
- List<String> conferenceableConnectionIds) {
+ List<String> conferenceableConnectionIds,
+ Bundle extras) {
mPhoneAccount = phoneAccount;
mState = state;
mConnectionCapabilities = capabilities;
@@ -76,7 +79,8 @@ public final class ParcelableConnection implements Parcelable {
mIsVoipAudioMode = isVoipAudioMode;
mStatusHints = statusHints;
mDisconnectCause = disconnectCause;
- this.mConferenceableConnectionIds = conferenceableConnectionIds;
+ mConferenceableConnectionIds = conferenceableConnectionIds;
+ mExtras = extras;
}
public PhoneAccountHandle getPhoneAccount() {
@@ -136,15 +140,21 @@ public final class ParcelableConnection implements Parcelable {
return mConferenceableConnectionIds;
}
+ public final Bundle getExtras() {
+ return mExtras;
+ }
+
@Override
public String toString() {
return new StringBuilder()
.append("ParcelableConnection [act:")
.append(mPhoneAccount)
- .append(", state:")
+ .append("], state:")
.append(mState)
.append(", capabilities:")
.append(Connection.capabilitiesToString(mConnectionCapabilities))
+ .append(", extras:")
+ .append(mExtras)
.toString();
}
@@ -170,6 +180,7 @@ public final class ParcelableConnection implements Parcelable {
DisconnectCause disconnectCause = source.readParcelable(classLoader);
List<String> conferenceableConnectionIds = new ArrayList<>();
source.readStringList(conferenceableConnectionIds);
+ Bundle extras = source.readBundle(classLoader);
return new ParcelableConnection(
phoneAccount,
@@ -185,7 +196,8 @@ public final class ParcelableConnection implements Parcelable {
audioModeIsVoip,
statusHints,
disconnectCause,
- conferenceableConnectionIds);
+ conferenceableConnectionIds,
+ extras);
}
@Override
@@ -218,5 +230,6 @@ public final class ParcelableConnection implements Parcelable {
destination.writeParcelable(mStatusHints, 0);
destination.writeParcelable(mDisconnectCause, 0);
destination.writeStringList(mConferenceableConnectionIds);
+ destination.writeBundle(mExtras);
}
}
diff --git a/telecomm/java/android/telecom/RemoteConference.java b/telecomm/java/android/telecom/RemoteConference.java
index 095a88f..c2261c3 100644
--- a/telecomm/java/android/telecom/RemoteConference.java
+++ b/telecomm/java/android/telecom/RemoteConference.java
@@ -18,7 +18,9 @@ package android.telecom;
import com.android.internal.telecom.IConnectionService;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
+import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
@@ -49,6 +51,7 @@ public final class RemoteConference {
RemoteConference conference,
List<RemoteConnection> conferenceableConnections) {}
public void onDestroyed(RemoteConference conference) {}
+ public void onExtrasChanged(RemoteConference conference, @Nullable Bundle extras) {}
}
private final String mId;
@@ -65,6 +68,7 @@ public final class RemoteConference {
private int mState = Connection.STATE_NEW;
private DisconnectCause mDisconnectCause;
private int mConnectionCapabilities;
+ private Bundle mExtras;
/** @hide */
RemoteConference(String id, IConnectionService connectionService) {
@@ -209,6 +213,21 @@ public final class RemoteConference {
}
}
+ /** @hide */
+ void setExtras(final Bundle extras) {
+ mExtras = extras;
+ for (CallbackRecord<Callback> record : mCallbackRecords) {
+ final RemoteConference conference = this;
+ final Callback callback = record.getCallback();
+ record.getHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ callback.onExtrasChanged(conference, extras);
+ }
+ });
+ }
+ }
+
/**
* Returns the list of {@link RemoteConnection}s contained in this conference.
*
@@ -238,6 +257,15 @@ public final class RemoteConference {
}
/**
+ * Obtain the extras associated with this {@code RemoteConnection}.
+ *
+ * @return The extras for this connection.
+ */
+ public final Bundle getExtras() {
+ return mExtras;
+ }
+
+ /**
* Disconnects the conference call as well as the child {@link RemoteConnection}s.
*/
public void disconnect() {
diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java
index 1d6e15c..9003ed1 100644
--- a/telecomm/java/android/telecom/RemoteConnection.java
+++ b/telecomm/java/android/telecom/RemoteConnection.java
@@ -20,8 +20,10 @@ import com.android.internal.telecom.IConnectionService;
import com.android.internal.telecom.IVideoCallback;
import com.android.internal.telecom.IVideoProvider;
+import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.net.Uri;
+import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
@@ -197,9 +199,17 @@ public final class RemoteConnection {
public void onConferenceChanged(
RemoteConnection connection,
RemoteConference conference) {}
+
+ /**
+ * Handles changes to the {@code RemoteConference} extras.
+ *
+ * @param connection The {@code RemoteConnection} invoking this method.
+ * @param extras The extras containing other information associated with the connection.
+ */
+ public void onExtrasChanged(RemoteConnection connection, @Nullable Bundle extras) {}
}
- /** {@hide} */
+ /** @hide */
public static class VideoProvider {
public abstract static class Listener {
@@ -415,6 +425,7 @@ public final class RemoteConnection {
private String mCallerDisplayName;
private int mCallerDisplayNamePresentation;
private RemoteConference mConference;
+ private Bundle mExtras;
/**
* @hide
@@ -614,6 +625,15 @@ public final class RemoteConnection {
}
/**
+ * Obtain the extras associated with this {@code RemoteConnection}.
+ *
+ * @return The extras for this connection.
+ */
+ public final Bundle getExtras() {
+ return mExtras;
+ }
+
+ /**
* Determines whether this {@code RemoteConnection} is requesting ringback.
*
* @return Whether the {@code RemoteConnection} is requesting that the framework play a
@@ -1097,6 +1117,21 @@ public final class RemoteConnection {
}
}
+ /** @hide */
+ void setExtras(final Bundle extras) {
+ mExtras = extras;
+ for (CallbackRecord record : mCallbackRecords) {
+ final RemoteConnection connection = this;
+ final Callback callback = record.getCallback();
+ record.getHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ callback.onExtrasChanged(connection, extras);
+ }
+ });
+ }
+ }
+
/**
* Create a RemoteConnection represents a failure, and which will be in
* {@link Connection#STATE_DISCONNECTED}. Attempting to use it for anything will almost
diff --git a/telecomm/java/android/telecom/RemoteConnectionService.java b/telecomm/java/android/telecom/RemoteConnectionService.java
index 0208744..dc0de0c 100644
--- a/telecomm/java/android/telecom/RemoteConnectionService.java
+++ b/telecomm/java/android/telecom/RemoteConnectionService.java
@@ -17,6 +17,7 @@
package android.telecom;
import android.net.Uri;
+import android.os.Bundle;
import android.os.IBinder;
import android.os.IBinder.DeathRecipient;
import android.os.RemoteException;
@@ -318,6 +319,17 @@ final class RemoteConnectionService {
mOurConnectionServiceImpl.addRemoteExistingConnection(remoteConnction);
}
+
+ @Override
+ public void setExtras(String callId, Bundle extras) {
+ if (mConnectionById.containsKey(callId)) {
+ findConnectionForAction(callId, "setExtras")
+ .setExtras(extras);
+ } else {
+ findConferenceForAction(callId, "setExtras")
+ .setExtras(extras);
+ }
+ }
};
private final ConnectionServiceAdapterServant mServant =
diff --git a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
index 67e2edb..7647444 100644
--- a/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
+++ b/telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl
@@ -18,6 +18,7 @@ package com.android.internal.telecom;
import android.app.PendingIntent;
import android.net.Uri;
+import android.os.Bundle;
import android.telecom.ConnectionRequest;
import android.telecom.DisconnectCause;
import android.telecom.ParcelableConnection;
@@ -83,4 +84,6 @@ oneway interface IConnectionServiceAdapter {
void setConferenceableConnections(String callId, in List<String> conferenceableCallIds);
void addExistingConnection(String callId, in ParcelableConnection connection);
+
+ void setExtras(String callId, in Bundle extras);
}