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
diff --git a/telecomm/java/android/telecom/ParcelableCall.java b/telecomm/java/android/telecom/ParcelableCall.java
index bb65ce9a..8cf4aeb 100644
--- a/telecomm/java/android/telecom/ParcelableCall.java
+++ b/telecomm/java/android/telecom/ParcelableCall.java
@@ -54,6 +54,7 @@
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 @@
StatusHints statusHints,
int videoState,
List<String> conferenceableCallIds,
+ Bundle intentExtras,
Bundle extras) {
mId = id;
mState = state;
@@ -98,6 +100,7 @@
mStatusHints = statusHints;
mVideoState = videoState;
mConferenceableCallIds = Collections.unmodifiableList(conferenceableCallIds);
+ mIntentExtras = intentExtras;
mExtras = extras;
}
@@ -227,7 +230,7 @@
}
/**
- * Any extras to pass with the call
+ * Any extras associated with this call.
*
* @return a bundle of extras
*/
@@ -236,6 +239,15 @@
}
/**
+ * 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 @@
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 @@
statusHints,
videoState,
conferenceableCallIds,
+ intentExtras,
extras);
}
@@ -338,7 +352,8 @@
destination.writeParcelable(mStatusHints, 0);
destination.writeInt(mVideoState);
destination.writeList(mConferenceableCallIds);
- destination.writeParcelable(mExtras, 0);
+ destination.writeBundle(mIntentExtras);
+ destination.writeBundle(mExtras);
}
@Override