summaryrefslogtreecommitdiffstats
path: root/telecomm
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2014-03-19 11:47:02 -0700
committerYorke Lee <yorkelee@google.com>2014-03-21 18:36:26 -0700
commit93fb1d00bc318079e58e53db39b4850adc31ffa1 (patch)
tree3152547d3d6e15d70952301352999b0a83674181 /telecomm
parentfb504779320f7343dfc5a0abe12954f922dd90b0 (diff)
downloadframeworks_base-93fb1d00bc318079e58e53db39b4850adc31ffa1.zip
frameworks_base-93fb1d00bc318079e58e53db39b4850adc31ffa1.tar.gz
frameworks_base-93fb1d00bc318079e58e53db39b4850adc31ffa1.tar.bz2
Add gateway support to frameworks/base/telecomm
Add parcelable GatewayInfo class used to store gateway info in Call and CallInfo. Add gateway-related string constants to TelecommConstants Bug: 13477768 Change-Id: I35b2de2d66edeed6273f6cba5329ca0f26264db6
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecomm/CallInfo.java45
-rw-r--r--telecomm/java/android/telecomm/GatewayInfo.aidl19
-rw-r--r--telecomm/java/android/telecomm/GatewayInfo.java106
3 files changed, 167 insertions, 3 deletions
diff --git a/telecomm/java/android/telecomm/CallInfo.java b/telecomm/java/android/telecomm/CallInfo.java
index b1413a6..bb08c2a 100644
--- a/telecomm/java/android/telecomm/CallInfo.java
+++ b/telecomm/java/android/telecomm/CallInfo.java
@@ -19,7 +19,6 @@ package android.telecomm;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
-import android.os.Parcelable;
import java.util.Date;
import java.util.UUID;
@@ -47,6 +46,11 @@ public final class CallInfo implements Parcelable {
*/
private final Uri mHandle;
+ /**
+ * Gateway information for the call.
+ */
+ private final GatewayInfo mGatewayInfo;
+
// There are 4 timestamps that are important to a call:
// 1) Created timestamp - The time at which the user explicitly chose to make the call.
// 2) Connected timestamp - The time at which a call service confirms that it has connected
@@ -59,17 +63,25 @@ public final class CallInfo implements Parcelable {
// other party.
// 4) Disconnected timestamp - The time at which the call was disconnected.
+ public CallInfo(String id, CallState state, Uri handle) {
+ this(id, state, handle, null);
+ }
+
/**
* Persists handle of the other party of this call.
*
* @param id The unique ID of the call.
* @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.
+ *
+ * @hide
*/
- public CallInfo(String id, CallState state, Uri handle) {
+ public CallInfo(String id, CallState state, Uri handle, GatewayInfo gatewayInfo) {
mId = id;
mState = state;
mHandle = handle;
+ mGatewayInfo = gatewayInfo;
}
public String getId() {
@@ -84,6 +96,22 @@ public final class CallInfo implements Parcelable {
return mHandle;
}
+ /**
+ * @return The actual handle this call is associated with. This is used by call services to
+ * correctly indicate in their UI what handle the user is actually calling, and by other
+ * telecomm components that require the user-dialed handle to function.
+ */
+ public Uri getOriginalHandle() {
+ if (mGatewayInfo != null) {
+ return mGatewayInfo.getOriginalHandle();
+ }
+ return getHandle();
+ }
+
+ public GatewayInfo getGatewayInfo() {
+ return mGatewayInfo;
+ }
+
//
// Parceling related code below here.
//
@@ -99,8 +127,13 @@ public final class CallInfo implements Parcelable {
String id = source.readString();
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);
+ }
- return new CallInfo(id, state, handle);
+ return new CallInfo(id, state, handle, gatewayInfo);
}
@Override
@@ -125,5 +158,11 @@ public final class CallInfo implements Parcelable {
destination.writeString(mId);
destination.writeString(mState.name());
mHandle.writeToParcel(destination, 0);
+ if (mGatewayInfo != null) {
+ destination.writeByte((byte) 1);
+ mGatewayInfo.writeToParcel(destination, 0);
+ } else {
+ destination.writeByte((byte) 0);
+ }
}
}
diff --git a/telecomm/java/android/telecomm/GatewayInfo.aidl b/telecomm/java/android/telecomm/GatewayInfo.aidl
new file mode 100644
index 0000000..d59e9b4
--- /dev/null
+++ b/telecomm/java/android/telecomm/GatewayInfo.aidl
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2014, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telecomm;
+
+parcelable GatewayInfo;
diff --git a/telecomm/java/android/telecomm/GatewayInfo.java b/telecomm/java/android/telecomm/GatewayInfo.java
new file mode 100644
index 0000000..b95e6b6
--- /dev/null
+++ b/telecomm/java/android/telecomm/GatewayInfo.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2014, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telecomm;
+
+import android.net.Uri;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.text.TextUtils;
+
+/**
+ * When calls are made, they may contain gateway information for services which route phone calls
+ * through their own service/numbers. The data consists of a number to call and the package name of
+ * the service. This data is used in two ways:
+ * <ol>
+ * <li> Call the appropriate routing number
+ * <li> Display information about how the call is being routed to the user
+ * </ol>
+ */
+public class GatewayInfo implements Parcelable {
+
+ private final String mGatewayProviderPackageName;
+ private final Uri mGatewayHandle;
+ private final Uri mOriginalHandle;
+
+ /** @hide */
+ public GatewayInfo(String packageName, Uri gatewayUri, Uri originalHandle) {
+ mGatewayProviderPackageName = packageName;
+ mGatewayHandle = gatewayUri;
+ mOriginalHandle = originalHandle;
+ }
+
+ /**
+ * Package name of the gateway provider service. used to place the call with.
+ */
+ public String getGatewayProviderPackageName() {
+ return mGatewayProviderPackageName;
+ }
+
+ /**
+ * Gateway provider handle to use when actually placing the call.
+ */
+ public Uri getGatewayHandle() {
+ return mGatewayHandle;
+ }
+
+ /**
+ * The actual call handle that the user is trying to connect to via the gateway.
+ */
+ public Uri getOriginalHandle() {
+ return mOriginalHandle;
+ }
+
+ public boolean isEmpty() {
+ return TextUtils.isEmpty(mGatewayProviderPackageName) || mGatewayHandle == null;
+ }
+
+ /** Implement the Parcelable interface */
+ public static final Parcelable.Creator<GatewayInfo> CREATOR =
+ new Parcelable.Creator<GatewayInfo> () {
+
+ @Override
+ public GatewayInfo createFromParcel(Parcel source) {
+ String gatewayPackageName = source.readString();
+ Uri gatewayUri = Uri.CREATOR.createFromParcel(source);
+ Uri originalHandle = Uri.CREATOR.createFromParcel(source);
+ return new GatewayInfo(gatewayPackageName, gatewayUri, originalHandle);
+ }
+
+ @Override
+ public GatewayInfo[] newArray(int size) {
+ return new GatewayInfo[size];
+ }
+ };
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void writeToParcel(Parcel destination, int flags) {
+ destination.writeString(mGatewayProviderPackageName);
+ mGatewayHandle.writeToParcel(destination, 0);
+ mOriginalHandle.writeToParcel(destination, 0);
+ }
+}