summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/current.txt24
-rw-r--r--telecomm/java/android/telecomm/CallServiceInfo.aidl19
-rw-r--r--telecomm/java/android/telecomm/CallServiceInfo.java203
-rw-r--r--telecomm/java/android/telecomm/ICallServiceLookupResponse.aidl11
-rw-r--r--telecomm/java/android/telecomm/ICallServiceSelectionResponse.aidl7
-rw-r--r--telecomm/java/android/telecomm/ICallServiceSelector.aidl3
6 files changed, 255 insertions, 12 deletions
diff --git a/api/current.txt b/api/current.txt
index 35ffe51..0d75264 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -24193,6 +24193,24 @@ package android.telecomm {
method public abstract void setCallServiceAdapter(android.telecomm.ICallServiceAdapter);
}
+ public final class CallServiceInfo implements android.os.Parcelable {
+ method public int describeContents();
+ method public java.lang.String getCallServiceId();
+ method public int getNetworkType();
+ method public android.content.ComponentName getServiceComponent();
+ method public static android.telecomm.CallServiceInfo.Builder newBuilder(android.content.Context);
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final int FLAG_MOBILE = 4; // 0x4
+ field public static final int FLAG_PSTN = 2; // 0x2
+ field public static final int FLAG_WIFI = 1; // 0x1
+ }
+
+ public static class CallServiceInfo.Builder {
+ method public android.telecomm.CallServiceInfo build();
+ method public android.telecomm.CallServiceInfo.Builder setCallService(java.lang.Class<? extends android.telecomm.CallService>);
+ method public android.telecomm.CallServiceInfo.Builder setNetworkType(int);
+ }
+
public abstract class CallServiceProvider extends android.app.Service {
ctor protected CallServiceProvider();
method public abstract void lookupCallServices(android.telecomm.ICallServiceLookupResponse);
@@ -24242,7 +24260,7 @@ package android.telecomm {
}
public abstract interface ICallServiceLookupResponse implements android.os.IInterface {
- method public abstract void setCallServices(java.util.List<android.os.IBinder>) throws android.os.RemoteException;
+ method public abstract void setCallServices(java.util.List<android.telecomm.CallServiceInfo>) throws android.os.RemoteException;
}
public static abstract class ICallServiceLookupResponse.Stub extends android.os.Binder implements android.telecomm.ICallServiceLookupResponse {
@@ -24264,7 +24282,7 @@ package android.telecomm {
}
public abstract interface ICallServiceSelectionResponse implements android.os.IInterface {
- method public abstract void setSelectedCallServiceIds(java.util.List<java.lang.String>) throws android.os.RemoteException;
+ method public abstract void setSelectedCallServiceInfos(java.util.List<android.telecomm.CallServiceInfo>) throws android.os.RemoteException;
}
public static abstract class ICallServiceSelectionResponse.Stub extends android.os.Binder implements android.telecomm.ICallServiceSelectionResponse {
@@ -24276,7 +24294,7 @@ package android.telecomm {
public abstract interface ICallServiceSelector implements android.os.IInterface {
method public abstract void isSwitchable(android.telecomm.CallInfo, android.telecomm.ICallSwitchabilityResponse) throws android.os.RemoteException;
- method public abstract void select(android.telecomm.CallInfo, java.util.List<java.lang.String>, android.telecomm.ICallServiceSelectionResponse) throws android.os.RemoteException;
+ method public abstract void select(android.telecomm.CallInfo, java.util.List<android.telecomm.CallServiceInfo>, android.telecomm.ICallServiceSelectionResponse) throws android.os.RemoteException;
}
public static abstract class ICallServiceSelector.Stub extends android.os.Binder implements android.telecomm.ICallServiceSelector {
diff --git a/telecomm/java/android/telecomm/CallServiceInfo.aidl b/telecomm/java/android/telecomm/CallServiceInfo.aidl
new file mode 100644
index 0000000..fa6dea0
--- /dev/null
+++ b/telecomm/java/android/telecomm/CallServiceInfo.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 CallServiceInfo;
diff --git a/telecomm/java/android/telecomm/CallServiceInfo.java b/telecomm/java/android/telecomm/CallServiceInfo.java
new file mode 100644
index 0000000..f6d0827
--- /dev/null
+++ b/telecomm/java/android/telecomm/CallServiceInfo.java
@@ -0,0 +1,203 @@
+/*
+ * 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.content.ComponentName;
+import android.content.Context;
+import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.Log;
+
+import java.util.UUID;
+
+/**
+ * An immutable object containing information about a given {@link CallService}. Instances are
+ * created using the enclosed {@link Builder}.
+ */
+public final class CallServiceInfo implements Parcelable {
+ private static final String TAG = CallServiceInfo.class.getSimpleName();
+
+ /**
+ * A placeholder value indicating an invalid network type.
+ * @hide
+ */
+ private static final int FLAG_INVALID = 0;
+
+ /**
+ * Indicates that the device must be connected to a Wi-Fi network in order for the backing
+ * {@link CallService} to be used.
+ */
+ public static final int FLAG_WIFI = 0x01;
+
+ /**
+ * Indicates that the device must be connected to a cellular PSTN network in order for the
+ * backing {@link CallService} to be used.
+ */
+ public static final int FLAG_PSTN = 0x02;
+
+ /**
+ * Indicates that the device must be connected to a cellular data network in order for the
+ * backing {@link CallService} to be used.
+ */
+ public static final int FLAG_MOBILE = 0x04;
+
+ /**
+ * Represents all of the defined FLAG_ constants so validity can be easily checked.
+ * @hide
+ */
+ public static final int FLAG_ALL = FLAG_WIFI | FLAG_PSTN | FLAG_MOBILE;
+
+ /**
+ * A unique ID used to identify a given instance.
+ */
+ private final String mCallServiceId;
+
+ /**
+ * The {@link ComponentName} of the {@link CallService} implementation which this is describing.
+ */
+ private final ComponentName mComponentName;
+
+ /**
+ * The type of connection that the {@link CallService} requires; will be one of the FLAG_*
+ * constants defined in this class.
+ */
+ private final int mNetworkType;
+
+ private CallServiceInfo(String callServiceId, ComponentName componentName, int networkType) {
+ mCallServiceId = callServiceId;
+ mComponentName = componentName;
+ mNetworkType = networkType;
+ }
+
+ /**
+ * @return The ID used to identify this {@link CallService}.
+ */
+ public String getCallServiceId() {
+ return mCallServiceId;
+ }
+
+ /**
+ * @return The {@link ComponentName} of the {@link CallService}.
+ */
+ public ComponentName getServiceComponent() {
+ return mComponentName;
+ }
+
+ /**
+ * @return The network type required by the {@link CallService} to place a call.
+ */
+ public int getNetworkType() {
+ return mNetworkType;
+ }
+
+ /**
+ * @param context {@link Context} to use for the construction of the {@link Builder}.
+ * @return A new {@link Builder} instance.
+ */
+ public static Builder newBuilder(Context context) {
+ return new Builder(context);
+ }
+
+ /**
+ * Creates {@link CallServiceInfo} instances. Builders should be created with the
+ * {@link CallServiceInfo#newBuilder(Context)} method.
+ */
+ public static class Builder {
+ /** The {@link Context} to use to verify {@link ComponentName} ownership. */
+ private Context mContext;
+
+ /** The {@link ComponentName} pointing to the backing {@link CallService}. */
+ private ComponentName mComponentName;
+
+ /** The required network type that the {@link CallService} needs. */
+ private int mNetworkType = FLAG_INVALID;
+
+ private Builder(Context context) {
+ mContext = context;
+ }
+
+ /**
+ * Set which {@link CallService} this {@link CallServiceInfo} is describing.
+ *
+ * @param callServiceClass The {@link CallService} class
+ * @return This {@link Builder} for method chaining.
+ */
+ public Builder setCallService(Class<? extends CallService> callServiceClass) {
+ mComponentName = new ComponentName(mContext, callServiceClass);
+ return this;
+ }
+
+ /**
+ * Which network type the backing {@link CallService} requires. This must be one of the
+ * {@link CallServiceInfo}.TYPE_* fields.
+ *
+ * @param networkType Which network type the backing {@link CallService} requires.
+ * @return This {@link Builder} for method chaining.
+ */
+ public Builder setNetworkType(int networkType) {
+ mNetworkType = networkType;
+ return this;
+ }
+
+ /**
+ * @return A constructed {@link CallServiceInfo} object.
+ */
+ public CallServiceInfo build() {
+ // STOPSHIP: Verify validity of ComponentName (permissions, intents, etc)
+
+ // Make sure that they passed in a valid network flag combination
+ if (mNetworkType == FLAG_INVALID || ((mNetworkType & FLAG_ALL) == 0)) {
+
+ Log.wtf(TAG, "Invalid network type for " + mComponentName);
+ // Revert them back to TYPE_INVALID so it won't be considered.
+ mNetworkType = FLAG_INVALID;
+ }
+
+ // TODO: Should we use a sha1 of the ComponentName? Would prevent duplicates.
+ return new CallServiceInfo(UUID.randomUUID().toString(), mComponentName, mNetworkType);
+ }
+ }
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(mCallServiceId);
+ dest.writeParcelable(mComponentName, 0);
+ dest.writeInt(mNetworkType);
+ }
+
+ static final Creator<CallServiceInfo> CREATOR = new Creator<CallServiceInfo>() {
+ @Override
+ public CallServiceInfo createFromParcel(Parcel source) {
+ String id = source.readString();
+ ComponentName componentName = source.readParcelable(
+ CallServiceInfo.class.getClassLoader());
+ int networkType = source.readInt();
+
+ return new CallServiceInfo(id, componentName, networkType);
+ }
+
+ @Override
+ public CallServiceInfo[] newArray(int size) {
+ return new CallServiceInfo[size];
+ }
+ };
+}
diff --git a/telecomm/java/android/telecomm/ICallServiceLookupResponse.aidl b/telecomm/java/android/telecomm/ICallServiceLookupResponse.aidl
index a3153f2..146d5f6 100644
--- a/telecomm/java/android/telecomm/ICallServiceLookupResponse.aidl
+++ b/telecomm/java/android/telecomm/ICallServiceLookupResponse.aidl
@@ -17,6 +17,7 @@
package android.telecomm;
import android.os.IBinder;
+import android.telecomm.CallServiceInfo;
import java.util.List;
/**
@@ -24,11 +25,11 @@ import java.util.List;
*/
oneway interface ICallServiceLookupResponse {
/**
- * Forwards the list of {@link ICallService}s as a list of {@link IBinder}s to be processed by
- * Telecomm which will choose which call service, among potentially many, to place a call.
+ * Forwards the list of {@link ICallService}s as a list of {@link CallServiceInfo}s to be
+ * processed by Telecomm which will choose which call service, among potentially many, to
+ * place a call.
*
- * @param callServices List of call services from {@link ICallServiceProvider}.
- * TODO(gilad): Rename to callServiceBinders.
+ * @param callServices The set of call service descriptors from {@link ICallServiceProvider}.
*/
- void setCallServices(in List<IBinder> callServices);
+ void setCallServices(in List<CallServiceInfo> callServices);
}
diff --git a/telecomm/java/android/telecomm/ICallServiceSelectionResponse.aidl b/telecomm/java/android/telecomm/ICallServiceSelectionResponse.aidl
index d3032ea..1376763 100644
--- a/telecomm/java/android/telecomm/ICallServiceSelectionResponse.aidl
+++ b/telecomm/java/android/telecomm/ICallServiceSelectionResponse.aidl
@@ -17,6 +17,7 @@
package android.telecomm;
import android.os.IBinder;
+import android.telecomm.CallServiceInfo;
import java.util.List;
/**
@@ -28,8 +29,8 @@ oneway interface ICallServiceSelectionResponse {
* Records the sorted set of call services that are preferred by the corresponding
* call-service selector.
*
- * @param selectedCallServiceIds The relevant call-service IDs ordered by priority (most desired
- * first).
+ * @param selectedCallServiceInfos The prioritized list of preferred CallServices to use for
+ * completing the call.
*/
- void setSelectedCallServiceIds(in List<String> selectedCallServiceIds);
+ void setSelectedCallServiceInfos(in List<CallServiceInfo> selectedCallServiceInfos);
}
diff --git a/telecomm/java/android/telecomm/ICallServiceSelector.aidl b/telecomm/java/android/telecomm/ICallServiceSelector.aidl
index ffdfd91..9652dec 100644
--- a/telecomm/java/android/telecomm/ICallServiceSelector.aidl
+++ b/telecomm/java/android/telecomm/ICallServiceSelector.aidl
@@ -17,6 +17,7 @@
package android.telecomm;
import android.telecomm.CallInfo;
+import android.telecomm.CallServiceInfo;
import android.telecomm.ICallService;
import android.telecomm.ICallServiceSelectionResponse;
import android.telecomm.ICallSwitchabilityResponse;
@@ -74,7 +75,7 @@ oneway interface ICallServiceSelector {
*/
void select(
in CallInfo callInfo,
- in List<String> callServiceIds,
+ in List<CallServiceInfo> callServiceInfos,
in ICallServiceSelectionResponse response);
/**