summaryrefslogtreecommitdiffstats
path: root/telecomm/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'telecomm/java/android')
-rw-r--r--telecomm/java/android/telecomm/CallInfo.java54
-rw-r--r--telecomm/java/android/telecomm/InCallCall.java17
2 files changed, 56 insertions, 15 deletions
diff --git a/telecomm/java/android/telecomm/CallInfo.java b/telecomm/java/android/telecomm/CallInfo.java
index 4de9373..17efed5 100644
--- a/telecomm/java/android/telecomm/CallInfo.java
+++ b/telecomm/java/android/telecomm/CallInfo.java
@@ -24,7 +24,7 @@ import android.os.Parcelable;
import java.util.Date;
/**
- * A parcelable holder class of Call information data. This class is intended for transfering call
+ * A parcelable holder class of Call information data. This class is intended for transferring call
* information from Telecomm to call services and thus is read-only.
* TODO(santoscordon): Need final public-facing comments in this file.
*/
@@ -52,6 +52,11 @@ public final class CallInfo implements Parcelable {
private final GatewayInfo mGatewayInfo;
/**
+ * Subscription information for the call.
+ */
+ private final Subscription mSubscription;
+
+ /**
* Additional information that can be persisted.
*/
private final Bundle mExtras;
@@ -60,7 +65,7 @@ public final class CallInfo implements Parcelable {
private final CallServiceDescriptor mCurrentCallServiceDescriptor;
public CallInfo(String id, CallState state, Uri handle) {
- this(id, state, handle, null, Bundle.EMPTY, null);
+ this(id, state, handle, null, null, Bundle.EMPTY, null);
}
/**
@@ -70,6 +75,7 @@ public final class CallInfo implements Parcelable {
* @param state The state of the call.
* @param handle The handle to the other party in this call.
* @param gatewayInfo Gateway information pertaining to this call.
+ * @param subscription Subscription information pertaining to this call.
* @param extras Additional information that can be persisted.
* @param currentCallServiceDescriptor The descriptor for the call service currently routing
* this call.
@@ -81,12 +87,14 @@ public final class CallInfo implements Parcelable {
CallState state,
Uri handle,
GatewayInfo gatewayInfo,
+ Subscription subscription,
Bundle extras,
CallServiceDescriptor currentCallServiceDescriptor) {
mId = id;
mState = state;
mHandle = handle;
mGatewayInfo = gatewayInfo;
+ mSubscription = subscription;
mExtras = extras;
mCurrentCallServiceDescriptor = currentCallServiceDescriptor;
}
@@ -119,6 +127,10 @@ public final class CallInfo implements Parcelable {
return mGatewayInfo;
}
+ public Subscription getSubscription() {
+ return mSubscription;
+ }
+
public Bundle getExtras() {
return mExtras;
}
@@ -137,16 +149,13 @@ public final class CallInfo implements Parcelable {
CallState state = CallState.valueOf(source.readString());
Uri handle = Uri.CREATOR.createFromParcel(source);
- boolean gatewayInfoPresent = source.readByte() != 0;
- GatewayInfo gatewayInfo = null;
- if (gatewayInfoPresent) {
- gatewayInfo = GatewayInfo.CREATOR.createFromParcel(source);
- }
+ GatewayInfo gatewayInfo = readProviderInfoIfExists(source, GatewayInfo.CREATOR);
+ Subscription subscription = readProviderInfoIfExists(source, Subscription.CREATOR);
ClassLoader classLoader = CallInfo.class.getClassLoader();
Bundle extras = source.readParcelable(classLoader);
CallServiceDescriptor descriptor = source.readParcelable(classLoader);
- return new CallInfo(id, state, handle, gatewayInfo, extras, descriptor);
+ return new CallInfo(id, state, handle, gatewayInfo, subscription, extras, descriptor);
}
@Override
@@ -172,14 +181,35 @@ public final class CallInfo implements Parcelable {
destination.writeString(mState.name());
mHandle.writeToParcel(destination, 0);
- if (mGatewayInfo != null) {
+ writeProviderInfoIfExists(destination, mGatewayInfo);
+ writeProviderInfoIfExists(destination, mSubscription);
+
+ destination.writeParcelable(mExtras, 0);
+ destination.writeParcelable(mCurrentCallServiceDescriptor, 0);
+ }
+
+ /**
+ * Helper function to write provider information (either GatewayInfo or Subscription) to
+ * parcel. Will write a false byte if the information does not exist.
+ */
+ private void writeProviderInfoIfExists(Parcel destination, Parcelable provider) {
+ if (provider != null) {
destination.writeByte((byte) 1);
- mGatewayInfo.writeToParcel(destination, 0);
+ provider.writeToParcel(destination, 0);
} else {
destination.writeByte((byte) 0);
}
+ }
- destination.writeParcelable(mExtras, 0);
- destination.writeParcelable(mCurrentCallServiceDescriptor, 0);
+ /**
+ * Helper function to read provider information (either GatewayInfo or Subscription) from
+ * parcel.
+ */
+ private static <T> T readProviderInfoIfExists(Parcel source,
+ Parcelable.Creator<T> creator) {
+ if (source.readByte() != 0) {
+ return creator.createFromParcel(source);
+ }
+ return null;
}
}
diff --git a/telecomm/java/android/telecomm/InCallCall.java b/telecomm/java/android/telecomm/InCallCall.java
index 66974f9..8cbe2e6 100644
--- a/telecomm/java/android/telecomm/InCallCall.java
+++ b/telecomm/java/android/telecomm/InCallCall.java
@@ -38,6 +38,7 @@ public final class InCallCall implements Parcelable {
private final long mConnectTimeMillis;
private final Uri mHandle;
private final GatewayInfo mGatewayInfo;
+ private final Subscription mSubscription;
private final CallServiceDescriptor mCurrentCallServiceDescriptor;
private final CallServiceDescriptor mHandoffCallServiceDescriptor;
private final String mParentCallId;
@@ -55,11 +56,12 @@ public final class InCallCall implements Parcelable {
long connectTimeMillis,
Uri handle,
GatewayInfo gatewayInfo,
+ Subscription subscription,
CallServiceDescriptor descriptor,
CallServiceDescriptor handoffDescriptor) {
this(id, state, disconnectCauseCode, disconnectCauseMsg, cannedSmsResponses,
- capabilities, connectTimeMillis, handle, gatewayInfo, descriptor, handoffDescriptor,
- null, Collections.EMPTY_LIST);
+ capabilities, connectTimeMillis, handle, gatewayInfo, subscription, descriptor,
+ handoffDescriptor, null, Collections.EMPTY_LIST);
}
/** @hide */
@@ -73,6 +75,7 @@ public final class InCallCall implements Parcelable {
long connectTimeMillis,
Uri handle,
GatewayInfo gatewayInfo,
+ Subscription subscription,
CallServiceDescriptor descriptor,
CallServiceDescriptor handoffDescriptor,
String parentCallId,
@@ -86,6 +89,7 @@ public final class InCallCall implements Parcelable {
mConnectTimeMillis = connectTimeMillis;
mHandle = handle;
mGatewayInfo = gatewayInfo;
+ mSubscription = subscription;
mCurrentCallServiceDescriptor = descriptor;
mHandoffCallServiceDescriptor = handoffDescriptor;
mParentCallId = parentCallId;
@@ -145,6 +149,11 @@ public final class InCallCall implements Parcelable {
return mGatewayInfo;
}
+ /** Subscription information for the call. */
+ public Subscription getSubscription() {
+ return mSubscription;
+ }
+
/** The descriptor for the call service currently routing this call. */
public CallServiceDescriptor getCurrentCallServiceDescriptor() {
return mCurrentCallServiceDescriptor;
@@ -191,6 +200,7 @@ public final class InCallCall implements Parcelable {
long connectTimeMillis = source.readLong();
Uri handle = source.readParcelable(classLoader);
GatewayInfo gatewayInfo = source.readParcelable(classLoader);
+ Subscription subscription = source.readParcelable(classLoader);
CallServiceDescriptor descriptor = source.readParcelable(classLoader);
CallServiceDescriptor handoffDescriptor = source.readParcelable(classLoader);
String parentCallId = source.readString();
@@ -198,7 +208,7 @@ public final class InCallCall implements Parcelable {
source.readList(childCallIds, classLoader);
return new InCallCall(id, state, disconnectCauseCode, disconnectCauseMsg,
cannedSmsResponses, capabilities, connectTimeMillis, handle, gatewayInfo,
- descriptor, handoffDescriptor, parentCallId, childCallIds);
+ subscription, descriptor, handoffDescriptor, parentCallId, childCallIds);
}
@Override
@@ -225,6 +235,7 @@ public final class InCallCall implements Parcelable {
destination.writeLong(mConnectTimeMillis);
destination.writeParcelable(mHandle, 0);
destination.writeParcelable(mGatewayInfo, 0);
+ destination.writeParcelable(mSubscription, 0);
destination.writeParcelable(mCurrentCallServiceDescriptor, 0);
destination.writeParcelable(mHandoffCallServiceDescriptor, 0);
destination.writeString(mParentCallId);