diff options
author | Santos Cordon <santoscordon@google.com> | 2014-01-16 19:53:05 -0800 |
---|---|---|
committer | Evan Charlton <evanc@google.com> | 2014-02-20 15:12:53 -0800 |
commit | 658c0cf6c3140b5cafc4e8880e08a7dead39d24a (patch) | |
tree | 7624f894a8513ebae9dcdb101f2eca7e2d65642a /telecomm | |
parent | 8986ef460188805a1af21ee5d8cd49a57d725d5e (diff) | |
download | frameworks_base-658c0cf6c3140b5cafc4e8880e08a7dead39d24a.zip frameworks_base-658c0cf6c3140b5cafc4e8880e08a7dead39d24a.tar.gz frameworks_base-658c0cf6c3140b5cafc4e8880e08a7dead39d24a.tar.bz2 |
Update the Telecomm APIs to use CallInfo.
Replace uses of callId and/or handle with a single, extensible CallInfo
object.
Change-Id: I4b7b86ccb7153e5dc49f4d3fa31f485fd06a960a
Diffstat (limited to 'telecomm')
-rw-r--r-- | telecomm/java/android/telecomm/CallInfo.java | 22 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/CallService.java | 47 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/ICallService.aidl | 21 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/ICallServiceAdapter.aidl | 13 | ||||
-rw-r--r-- | telecomm/java/android/telecomm/ICallServiceSelector.aidl | 13 |
5 files changed, 56 insertions, 60 deletions
diff --git a/telecomm/java/android/telecomm/CallInfo.java b/telecomm/java/android/telecomm/CallInfo.java index d964944..e96f3b4 100644 --- a/telecomm/java/android/telecomm/CallInfo.java +++ b/telecomm/java/android/telecomm/CallInfo.java @@ -20,6 +20,7 @@ import android.os.Parcel; import android.os.Parcelable; import java.util.Date; +import java.util.UUID; /** * A parcelable holder class of Call information data. This class is intended for transfering call @@ -35,6 +36,11 @@ public final class CallInfo implements Parcelable { */ private final String mHandle; + /** + * Unique identifier for the call as a UUID string. + */ + private String mId; + // 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 @@ -49,8 +55,12 @@ public final class CallInfo implements Parcelable { /** * Persists handle of the other party of this call. + * + * @param id The unique ID of the call. + * @param handle The handle to the other party in this call. */ - public CallInfo(String handle) { + public CallInfo(String id, String handle) { + mId = id; mHandle = handle; } @@ -58,6 +68,10 @@ public final class CallInfo implements Parcelable { return mHandle; } + public String getId() { + return mId; + } + // // Parceling related code below here. // @@ -70,7 +84,10 @@ public final class CallInfo implements Parcelable { @Override public CallInfo createFromParcel(Parcel source) { - return new CallInfo(source.readString()); + String id = source.readString(); + String handle = source.readString(); + + return new CallInfo(id, handle); } @Override @@ -92,6 +109,7 @@ public final class CallInfo implements Parcelable { */ @Override public void writeToParcel(Parcel destination, int flags) { + destination.writeString(mId); destination.writeString(mHandle); } } diff --git a/telecomm/java/android/telecomm/CallService.java b/telecomm/java/android/telecomm/CallService.java index 1f47a0a..148a136 100644 --- a/telecomm/java/android/telecomm/CallService.java +++ b/telecomm/java/android/telecomm/CallService.java @@ -59,25 +59,10 @@ public abstract class CallService extends Service { setCallServiceAdapter((ICallServiceAdapter) msg.obj); break; case MSG_IS_COMPATIBLE_WITH: - // See {@link CallServiceWrapper#isCompatibleWith} for dataObject definition. - try { - // TODO(santoscordon): Switch to using a custom class here instead. When we - // switch to using Call objects instead of handles directly, this may not even be - // necessary. - Pair<String, String> dataObject = (Pair<String, String>) msg.obj; - isCompatibleWith(dataObject.first, dataObject.second); - } catch (ClassCastException e) { - Log.e(TAG, "Unexpected object type for MSG_IS_COMPATIBLE_WITH.", e); - } + isCompatibleWith((CallInfo) msg.obj); break; case MSG_CALL: - // See {@link CallServiceWrapper#call} for dataObject definition. - try { - Pair<String, String> dataObject = (Pair<String, String>) msg.obj; - call(dataObject.first, dataObject.second); - } catch (ClassCastException e) { - Log.e(TAG, "Unexpected object type for MSG_CALL.", e); - } + call((CallInfo) msg.obj); break; case MSG_DISCONNECT: disconnect((String) msg.obj); @@ -99,15 +84,13 @@ public abstract class CallService extends Service { } @Override - public void isCompatibleWith(String handle, String callId) { - Pair<String, String> dataObject = new Pair<String, String>(handle, callId); - mMessageHandler.obtainMessage(MSG_IS_COMPATIBLE_WITH, dataObject).sendToTarget(); + public void isCompatibleWith(CallInfo callInfo) { + mMessageHandler.obtainMessage(MSG_IS_COMPATIBLE_WITH, callInfo).sendToTarget(); } @Override - public void call(String handle, String callId) { - Pair<String, String> dataObject = new Pair<String, String>(handle, callId); - mMessageHandler.obtainMessage(MSG_CALL, dataObject).sendToTarget(); + public void call(CallInfo callInfo) { + mMessageHandler.obtainMessage(MSG_CALL, callInfo).sendToTarget(); } @Override @@ -170,27 +153,25 @@ public abstract class CallService extends Service { public abstract void setCallServiceAdapter(ICallServiceAdapter callServiceAdapter); /** - * Determines if the CallService can make calls to the handle. Response is sent via - * ICallServiceAdapter. When responding, the correct call ID must be specified along with - * the handle. + * Determines if the CallService can place the specified call. Response is sent via + * {@link ICallServiceAdapter#setCompatibleWith}. When responding, the correct call ID must be + * specified. * - * @param handle The destination handle to test against. - * @param callId The call identifier associated with this compatibility request. + * @param callInfo The details of the relevant call. */ - public abstract void isCompatibleWith(String handle, String callId); + public abstract void isCompatibleWith(CallInfo callInfo); /** - * Attempts to call the relevant party using the specified handle, be it a phone number, + * Attempts to call the relevant party using the specified call's handle, be it a phone number, * SIP address, or some other kind of user ID. Note that the set of handle types is * dynamically extensible since call providers should be able to implement arbitrary * handle-calling systems. See {@link #isCompatibleWith}. It is expected that the * call service respond via {@link ICallServiceAdapter#newOutgoingCall} if it can successfully * make the call. * - * @param handle The destination handle to call. - * @param callId Unique identifier for the call. + * @param callInfo The details of the relevant call. */ - public abstract void call(String handle, String callId); + public abstract void call(CallInfo callInfo); /** * Disconnects the specified call. diff --git a/telecomm/java/android/telecomm/ICallService.aidl b/telecomm/java/android/telecomm/ICallService.aidl index 9d02234..d82e2f5 100644 --- a/telecomm/java/android/telecomm/ICallService.aidl +++ b/telecomm/java/android/telecomm/ICallService.aidl @@ -16,6 +16,7 @@ package android.telecomm; +import android.telecomm.CallInfo; import android.telecomm.ICallServiceAdapter; /** @@ -43,22 +44,19 @@ oneway interface ICallService { void setCallServiceAdapter(in ICallServiceAdapter callServiceAdapter); /** - * Determines if the ICallService can make calls to the handle. Response is sent via + * Determines if the ICallService can place the specified call. Response is sent via * {@link ICallServiceAdapter#setCompatibleWith}. When responding, the correct call ID must be - * specified along with the handle. It is expected that the call service respond within 500 - * milliseconds. Any response that takes longer than 500 milliseconds will be treated as being - * incompatible. + * specified. It is expected that the call service respond within 500 milliseconds. Any response + * that takes longer than 500 milliseconds will be treated as being incompatible. * TODO(santoscordon): 500 ms was arbitrarily chosen and must be confirmed before this * API is made public. - * TODO(santoscordon): Switch from specific parameters to CallInfo/Call. * - * @param handle The destination handle to test against. - * @param callId The call identifier associated with this compatibility request. + * @param callInfo The details of the relevant call. */ - void isCompatibleWith(String handle, String callId); + void isCompatibleWith(in CallInfo callInfo); /** - * Attempts to call the relevant party using the specified handle, be it a phone number, + * Attempts to call the relevant party using the specified call's handle, be it a phone number, * SIP address, or some other kind of user ID. Note that the set of handle types is * dynamically extensible since call providers should be able to implement arbitrary * handle-calling systems. See {@link #isCompatibleWith}. It is expected that the @@ -67,10 +65,9 @@ oneway interface ICallService { * TODO(santoscordon): Figure out how a calls service can short-circuit a failure to * the adapter. * - * @param handle The destination handle to call. - * @param callId Unique identifier for the call. + * @param callInfo The details of the relevant call. */ - void call(String handle, String callId); + void call(in CallInfo callInfo); /** * Disconnects the call identified by callId. diff --git a/telecomm/java/android/telecomm/ICallServiceAdapter.aidl b/telecomm/java/android/telecomm/ICallServiceAdapter.aidl index 71c5006..526351e 100644 --- a/telecomm/java/android/telecomm/ICallServiceAdapter.aidl +++ b/telecomm/java/android/telecomm/ICallServiceAdapter.aidl @@ -31,13 +31,16 @@ oneway interface ICallServiceAdapter { void getNextCallId(/* TODO(santoscordon): Needs response object */); /** - * Receives confirmation of the call service's ability to make a call to the specified handle. + * Receives confirmation of a call service's ability to place a call. This method is used in + * response to {@link ICallService#isCompatibleWith}. + * TODO(santoscordon): rename to setIsCompatibleWith(). * - * @param handle The handle to call. - * @param callId The identifier of the call for which compatibility is being received. - * @param isCompatible True if the call service can place a call to the handle. + * @param callId The identifier of the call for which compatibility is being received. This ID + * should correspond to the ID given as part of the call information in + * {@link ICallService#isCompatibleWith}. + * @param isCompatible True if the call service can place the call. */ - void setCompatibleWith(String handle, String callId, boolean isCompatible); + void setCompatibleWith(String callId, boolean isCompatible); /** * Tells CallsManager of a new incoming call. diff --git a/telecomm/java/android/telecomm/ICallServiceSelector.aidl b/telecomm/java/android/telecomm/ICallServiceSelector.aidl index 13a3f4c..58cbf6c 100644 --- a/telecomm/java/android/telecomm/ICallServiceSelector.aidl +++ b/telecomm/java/android/telecomm/ICallServiceSelector.aidl @@ -16,6 +16,7 @@ package android.telecomm; +import android.telecomm.CallInfo; import android.telecomm.ICallService; import android.telecomm.ICallServiceSelectionResponse; import android.telecomm.ICallSwitchabilityResponse; @@ -67,27 +68,23 @@ oneway interface ICallServiceSelector { /** * Initiates the process to retrieve the sorted set of call services that are preferred * by this call-service selector. - * TODO(gilad): Pass reduced-visibility call-service objects, see isSwitchable/callId below. - * TODO(gilad): Consider passing a Call object encapsulating the relevant call details (e.g. - * handle, contactInfo, etc). * - * @param handle The handle to dial. + * @param callInfo The details of the relevant call. * @param callServiceBinders The list of binders to select call services from. * @param response The response object through which the selected services are passed back * to the switchboard. */ void select( - String handle, + in CallInfo callInfo, in List<IBinder> callServiceBinders, in ICallServiceSelectionResponse response); /** * Determines if the specified ongoing call can/should be switched from the currently-used * call service to another. - * TODO(gilad): Pass a CallInfo instead that contains (among other fields) the callId. * - * @param callId The identifier of the call to disconnect. + * @param callInfo The details of the relevant call. * @param response The response object to be populated and returned to switchboard. */ - void isSwitchable(String callId, in ICallSwitchabilityResponse response); + void isSwitchable(in CallInfo callInfo, in ICallSwitchabilityResponse response); } |