diff options
author | Ihab Awad <ihab@google.com> | 2014-06-18 10:26:34 -0700 |
---|---|---|
committer | Ihab Awad <ihab@google.com> | 2014-06-23 19:59:27 -0700 |
commit | 52a28f619fca8c2118e1f421cb56f6542805e954 (patch) | |
tree | 053b0574422465140b76e6e9e5ade50aca1908c7 /telecomm | |
parent | 43015f241ebc6a03e36af4d300a3dbceeb078771 (diff) | |
download | frameworks_base-52a28f619fca8c2118e1f421cb56f6542805e954.zip frameworks_base-52a28f619fca8c2118e1f421cb56f6542805e954.tar.gz frameworks_base-52a28f619fca8c2118e1f421cb56f6542805e954.tar.bz2 |
Replace CallServiceSelectors with Subscriptions (1/3)
Remove CallServiceSelectors and replace them with comprehensive
support for Subscriptions as the means of selecting ways of making
phone calls. After this change, a ConnectionService is not a
semantically meaningful "way of making a call" -- it's more like the
mechanism whereby the Android system communicates with a 3rd party
process to ask for phone services. We anticipate each process having
only one ConnectionService.
Change-Id: I11e6e246ae999683b3800496e98c93c3351aca7b
Diffstat (limited to 'telecomm')
13 files changed, 24 insertions, 414 deletions
diff --git a/telecomm/java/android/telecomm/CallInfo.java b/telecomm/java/android/telecomm/CallInfo.java index cb7f2dc..4de9373 100644 --- a/telecomm/java/android/telecomm/CallInfo.java +++ b/telecomm/java/android/telecomm/CallInfo.java @@ -52,8 +52,7 @@ public final class CallInfo implements Parcelable { private final GatewayInfo mGatewayInfo; /** - * Additional information that can be persisted. For example, extra handoff information can - * attached to a call using {@link CallServiceSelectorAdapter#setHandoffInfo(String,Uri,Bundle). + * Additional information that can be persisted. */ private final Bundle mExtras; diff --git a/telecomm/java/android/telecomm/CallService.java b/telecomm/java/android/telecomm/CallService.java index 0b5981c..cf7c901 100644 --- a/telecomm/java/android/telecomm/CallService.java +++ b/telecomm/java/android/telecomm/CallService.java @@ -49,21 +49,20 @@ import java.util.List; public abstract class CallService extends Service { private static final int MSG_SET_CALL_SERVICE_ADAPTER = 1; - private static final int MSG_IS_COMPATIBLE_WITH = 2; - private static final int MSG_CALL = 3; - private static final int MSG_ABORT = 4; - private static final int MSG_SET_INCOMING_CALL_ID = 5; - private static final int MSG_ANSWER = 6; - private static final int MSG_REJECT = 7; - private static final int MSG_DISCONNECT = 8; - private static final int MSG_HOLD = 9; - private static final int MSG_UNHOLD = 10; - private static final int MSG_ON_AUDIO_STATE_CHANGED = 11; - private static final int MSG_PLAY_DTMF_TONE = 12; - private static final int MSG_STOP_DTMF_TONE = 13; - private static final int MSG_CONFERENCE = 14; - private static final int MSG_SPLIT_FROM_CONFERENCE = 15; - private static final int MSG_ON_POST_DIAL_CONTINUE = 16; + private static final int MSG_CALL = 2; + private static final int MSG_ABORT = 3; + private static final int MSG_SET_INCOMING_CALL_ID = 4; + private static final int MSG_ANSWER = 5; + private static final int MSG_REJECT = 6; + private static final int MSG_DISCONNECT = 7; + private static final int MSG_HOLD = 8; + private static final int MSG_UNHOLD = 9; + private static final int MSG_ON_AUDIO_STATE_CHANGED = 10; + private static final int MSG_PLAY_DTMF_TONE = 11; + private static final int MSG_STOP_DTMF_TONE = 12; + private static final int MSG_CONFERENCE = 13; + private static final int MSG_SPLIT_FROM_CONFERENCE = 14; + private static final int MSG_ON_POST_DIAL_CONTINUE = 15; /** * Default Handler used to consolidate binder method calls onto a single thread. @@ -76,9 +75,6 @@ public abstract class CallService extends Service { mAdapter = new CallServiceAdapter((ICallServiceAdapter) msg.obj); onAdapterAttached(mAdapter); break; - case MSG_IS_COMPATIBLE_WITH: - isCompatibleWith((CallInfo) msg.obj); - break; case MSG_CALL: call((CallInfo) msg.obj); break; @@ -170,11 +166,6 @@ public abstract class CallService extends Service { } @Override - public void isCompatibleWith(CallInfo callInfo) { - mMessageHandler.obtainMessage(MSG_IS_COMPATIBLE_WITH, callInfo).sendToTarget(); - } - - @Override public void call(CallInfo callInfo) { mMessageHandler.obtainMessage(MSG_CALL, callInfo).sendToTarget(); } @@ -300,21 +291,10 @@ public abstract class CallService extends Service { } /** - * Determines if the CallService can place the specified call. Response is sent via - * {@link CallServiceAdapter#setIsCompatibleWith}. When responding, the correct call ID must be - * specified. Only used in the context of outgoing calls and call switching (handoff). - * - * @param callInfo The details of the relevant call. - */ - public abstract void isCompatibleWith(CallInfo callInfo); - - /** * 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 CallServiceAdapter#handleSuccessfulOutgoingCall(String)} - * if it can successfully make the call. Only used in the context of outgoing calls. + * handle-calling systems. * * @param callInfo The details of the relevant call. */ diff --git a/telecomm/java/android/telecomm/CallServiceAdapter.java b/telecomm/java/android/telecomm/CallServiceAdapter.java index 0ba8161..2c5f078 100644 --- a/telecomm/java/android/telecomm/CallServiceAdapter.java +++ b/telecomm/java/android/telecomm/CallServiceAdapter.java @@ -37,22 +37,6 @@ public final class CallServiceAdapter { } /** - * Receives confirmation of a call service's ability to place a call. This method is used in - * response to {@link CallService#isCompatibleWith}. - * - * @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 CallService#isCompatibleWith}. - * @param isCompatible True if the call service can place the call. - */ - public void setIsCompatibleWith(String callId, boolean isCompatible) { - try { - mAdapter.setIsCompatibleWith(callId, isCompatible); - } catch (RemoteException e) { - } - } - - /** * Provides Telecomm with the details of an incoming call. An invocation of this method must * follow {@link CallService#setIncomingCallId} and use the call ID specified therein. Upon * the invocation of this method, Telecomm will bring up the incoming-call interface where the diff --git a/telecomm/java/android/telecomm/CallServiceSelector.java b/telecomm/java/android/telecomm/CallServiceSelector.java deleted file mode 100644 index c9c6ff6..0000000 --- a/telecomm/java/android/telecomm/CallServiceSelector.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (C) 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.app.Service; -import android.content.Intent; -import android.os.Handler; -import android.os.IBinder; -import android.os.Looper; -import android.os.Message; -import android.os.RemoteException; - -import com.android.internal.os.SomeArgs; -import com.android.internal.telecomm.ICallServiceSelector; -import com.android.internal.telecomm.ICallServiceSelectorAdapter; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; - -/** - * Allows for the organization of {@link CallService}s for outbound calls. Given a call and list of - * {@link CallService} IDs, order the list in terms of priority and return it using - * {@link #select(CallInfo, List)}. - */ -public abstract class CallServiceSelector extends Service { - private static final int MSG_SET_CALL_SERVICE_SELECTOR_ADAPTER = 0; - private static final int MSG_SELECT = 1; - - private final HashMap<String, CallInfo> mCalls = new HashMap<String, CallInfo>(); - - /** Handler to move client-bound method calls to the main thread. */ - private final Handler mHandler = new Handler(Looper.getMainLooper()) { - @Override - public void handleMessage(Message msg) { - switch (msg.what) { - case MSG_SET_CALL_SERVICE_SELECTOR_ADAPTER: - mAdapter = new CallServiceSelectorAdapter( - (ICallServiceSelectorAdapter) msg.obj); - onAdapterAttached(mAdapter); - break; - case MSG_SELECT: - SomeArgs args = (SomeArgs) msg.obj; - try { - select((CallInfo) args.arg1, (List<CallServiceDescriptor>) args.arg2); - } finally { - args.recycle(); - } - break; - } - } - }; - - /** Manages the binder calls so that the implementor does not need to deal with it. */ - private final class CallServiceSelectorBinder extends ICallServiceSelector.Stub { - @Override - public void setCallServiceSelectorAdapter(ICallServiceSelectorAdapter adapter) { - mHandler.obtainMessage(MSG_SET_CALL_SERVICE_SELECTOR_ADAPTER, adapter) - .sendToTarget(); - } - - @Override - public void select(CallInfo callInfo, List<CallServiceDescriptor> descriptors) { - SomeArgs args = SomeArgs.obtain(); - args.arg1 = callInfo; - args.arg2 = descriptors; - mHandler.obtainMessage(MSG_SELECT, args).sendToTarget(); - } - - @Override - public void onCallUpdated(CallInfo callInfo) { - mCalls.put(callInfo.getId(), callInfo); - } - - @Override - public void onCallRemoved(String callId) { - mCalls.remove(callId); - } - } - - private final CallServiceSelectorBinder mBinder; - - private CallServiceSelectorAdapter mAdapter = null; - - protected CallServiceSelector() { - mBinder = new CallServiceSelectorBinder(); - } - - @Override - public final IBinder onBind(Intent intent) { - return mBinder; - } - - /** - * Returns a list of all calls managed by this selector. - */ - protected final Collection<CallInfo> getCalls() { - return Collections.unmodifiableCollection(mCalls.values()); - } - - /** - * @return The attached {@link CallServiceSelectorAdapter} if attached, or null otherwise. - */ - protected final CallServiceSelectorAdapter getAdapter() { - return mAdapter; - } - - /** - * Cancel the outgoing call. Any subsequent calls to {@link #select(CallInfo, List)} will be - * ignored. - * - * @param callInfo The call to canceled. - */ - protected final void cancelOutgoingCall(CallInfo callInfo) { - getAdapter().cancelOutgoingCall(callInfo.getId()); - } - - /** - * Lifecycle callback which is called when this {@link CallServiceSelector} has been attached - * to a {@link CallServiceSelectorAdapter}, indicating {@link #getAdapter()} is now safe to use. - * - * @param adapter The adapter now attached to this call service selector. - */ - protected void onAdapterAttached(CallServiceSelectorAdapter adapter) { - } - - /** - * Given a list of {@link CallServiceDescriptor}s, order them into a prioritized list and return - * them through - * {@link CallServiceSelectorAdapter#setSelectedCallServices(String,List)}. - * - * @param callInfo The call being placed using the {@link CallService}s. - * @param descriptors The descriptors of the available {@link CallService}s with which to place - * the call. - */ - protected abstract void select(CallInfo callInfo, List<CallServiceDescriptor> descriptors); -} diff --git a/telecomm/java/android/telecomm/CallServiceSelectorAdapter.java b/telecomm/java/android/telecomm/CallServiceSelectorAdapter.java deleted file mode 100644 index 4d2e8aa..0000000 --- a/telecomm/java/android/telecomm/CallServiceSelectorAdapter.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 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.Bundle; -import android.os.RemoteException; -import android.telecomm.CallServiceDescriptor; - -import com.android.internal.telecomm.ICallServiceSelectorAdapter; - -import java.util.List; - -/** - * Provides methods for ICallServiceSelector implementations to interact with Telecomm. - */ -public final class CallServiceSelectorAdapter { - private final ICallServiceSelectorAdapter mAdapter; - - /** - * {@hide} - */ - public CallServiceSelectorAdapter(ICallServiceSelectorAdapter adapter) { - mAdapter = adapter; - } - - /** - * Records the sorted set of call services that are preferred by the corresponding - * call-service selector. - * - * @param callId The ID of the call to complete. - * @param selectedCallServiceDescriptors The prioritized list of preferred call-service - * descriptors to use for completing the call. - */ - public void setSelectedCallServices( - String callId, - List<CallServiceDescriptor> selectedCallServiceDescriptors) { - try { - mAdapter.setSelectedCallServices(callId, selectedCallServiceDescriptors); - } catch (RemoteException e) { - } - } - - /** - * Cancels the specified outgoing call. - * - * @param callId The ID of the call to cancel. - */ - public void cancelOutgoingCall(String callId) { - try { - mAdapter.cancelOutgoingCall(callId); - } catch (RemoteException e) { - } - } - - /** - * Associates handoff information with an ongoing call. Calls can switch from one call service - * to another. Setting handle to a non-null value marks the call as switchable. - * - * @param callId The ID of the call to set handoff information for. - * @param handle The handle used to place the call when switching. - * @param extras Optional extra that's attached to the call. - */ - public void setHandoffInfo(String callId, Uri handle, Bundle extras) { - try { - mAdapter.setHandoffInfo(callId, handle, extras); - } catch (RemoteException e) { - } - } -} diff --git a/telecomm/java/android/telecomm/Connection.java b/telecomm/java/android/telecomm/Connection.java index 164eeff..1783327 100644 --- a/telecomm/java/android/telecomm/Connection.java +++ b/telecomm/java/android/telecomm/Connection.java @@ -356,6 +356,13 @@ public abstract class Connection { } /** + * Returns whether this connection is capable of being conferenced. + */ + public boolean isConferenceCapable() { + return mIsConferenceCapable; + } + + /** * Sets the value of the {@link #getHandle()} property and notifies listeners. * * @param handle The new handle. diff --git a/telecomm/java/android/telecomm/ConnectionService.java b/telecomm/java/android/telecomm/ConnectionService.java index 8a4e123..5aba941 100644 --- a/telecomm/java/android/telecomm/ConnectionService.java +++ b/telecomm/java/android/telecomm/ConnectionService.java @@ -114,28 +114,6 @@ public abstract class ConnectionService extends CallService { }; @Override - public final void isCompatibleWith(final CallInfo callInfo) { - Log.d(this, "isCompatibleWith %s", callInfo); - onFindSubscriptions( - callInfo.getHandle(), - new Response<Uri, Subscription>() { - @Override - public void onResult(Uri handle, Subscription... result) { - boolean isCompatible = result.length > 0; - Log.d(this, "adapter setIsCompatibleWith "); - getAdapter().setIsCompatibleWith(callInfo.getId(), isCompatible); - } - - @Override - public void onError(Uri handle, int code, String msg) { - Log.w(this, "Error in onFindSubscriptions %s %d %s", handle, code, msg); - getAdapter().setIsCompatibleWith(callInfo.getId(), false); - } - } - ); - } - - @Override public final void call(final CallInfo callInfo) { Log.d(this, "call %s", callInfo); onCreateConnections( @@ -343,16 +321,6 @@ public abstract class ConnectionService extends CallService { } /** - * Find a set of Subscriptions matching a given handle (e.g. phone number). - * - * @param handle A handle (e.g. phone number) with which to connect. - * @param callback A callback for providing the result. - */ - public void onFindSubscriptions( - Uri handle, - Response<Uri, Subscription> callback) {} - - /** * Create a Connection given a request. * * @param request Data encapsulating details of the desired Connection. diff --git a/telecomm/java/android/telecomm/InCallService.java b/telecomm/java/android/telecomm/InCallService.java index c7dd23a..31291fb 100644 --- a/telecomm/java/android/telecomm/InCallService.java +++ b/telecomm/java/android/telecomm/InCallService.java @@ -156,7 +156,7 @@ public abstract class InCallService extends Service { } /** - * @return The attached {@link CallServiceSelectorAdapter} if attached, or null otherwise. + * @return The attached {@link InCallAdapter} if attached, or null otherwise. */ protected final InCallAdapter getAdapter() { return mAdapter; diff --git a/telecomm/java/android/telecomm/TelecommConstants.java b/telecomm/java/android/telecomm/TelecommConstants.java index 0a12c08..4c08da0 100644 --- a/telecomm/java/android/telecomm/TelecommConstants.java +++ b/telecomm/java/android/telecomm/TelecommConstants.java @@ -51,11 +51,6 @@ public final class TelecommConstants { public static final String ACTION_CALL_SERVICE = CallService.class.getName(); /** - * The service action used to bind to {@link CallServiceSelector} implementations. - */ - public static final String ACTION_CALL_SERVICE_SELECTOR = CallServiceSelector.class.getName(); - - /** * Optional extra for {@link Intent#ACTION_CALL} containing a boolean that determines whether * the speakerphone should be automatically turned on for an outgoing call. */ diff --git a/telecomm/java/com/android/internal/telecomm/ICallService.aidl b/telecomm/java/com/android/internal/telecomm/ICallService.aidl index 827f331..62ebd54 100644 --- a/telecomm/java/com/android/internal/telecomm/ICallService.aidl +++ b/telecomm/java/com/android/internal/telecomm/ICallService.aidl @@ -32,8 +32,6 @@ import com.android.internal.telecomm.ICallServiceAdapter; oneway interface ICallService { void setCallServiceAdapter(in ICallServiceAdapter callServiceAdapter); - void isCompatibleWith(in CallInfo callInfo); - void call(in CallInfo callInfo); void abort(String callId); diff --git a/telecomm/java/com/android/internal/telecomm/ICallServiceAdapter.aidl b/telecomm/java/com/android/internal/telecomm/ICallServiceAdapter.aidl index 6e176eb..270c551 100644 --- a/telecomm/java/com/android/internal/telecomm/ICallServiceAdapter.aidl +++ b/telecomm/java/com/android/internal/telecomm/ICallServiceAdapter.aidl @@ -27,8 +27,6 @@ import android.telecomm.ConnectionRequest; * {@hide} */ oneway interface ICallServiceAdapter { - void setIsCompatibleWith(String callId, boolean isCompatible); - void notifyIncomingCall(in CallInfo callInfo); void handleSuccessfulOutgoingCall(String callId); diff --git a/telecomm/java/com/android/internal/telecomm/ICallServiceSelector.aidl b/telecomm/java/com/android/internal/telecomm/ICallServiceSelector.aidl deleted file mode 100644 index 9597dc1..0000000 --- a/telecomm/java/com/android/internal/telecomm/ICallServiceSelector.aidl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 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 com.android.internal.telecomm; - -import android.telecomm.CallInfo; -import android.telecomm.CallServiceDescriptor; - -import com.android.internal.telecomm.ICallService; -import com.android.internal.telecomm.ICallServiceSelectorAdapter; - -import java.util.List; - -/** - * Internal remote interface for call service selectors. - * - * @see android.telecomm.CallServiceSelector - * - * @hide - */ -oneway interface ICallServiceSelector { - void setCallServiceSelectorAdapter(in ICallServiceSelectorAdapter adapter); - - void select(in CallInfo callInfo, in List<CallServiceDescriptor> callServiceDescriptors); - - void onCallUpdated(in CallInfo callInfo); - - void onCallRemoved(String callId); -} diff --git a/telecomm/java/com/android/internal/telecomm/ICallServiceSelectorAdapter.aidl b/telecomm/java/com/android/internal/telecomm/ICallServiceSelectorAdapter.aidl deleted file mode 100644 index ad71e3c..0000000 --- a/telecomm/java/com/android/internal/telecomm/ICallServiceSelectorAdapter.aidl +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 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 com.android.internal.telecomm; - -import android.net.Uri; -import android.os.Bundle; -import android.telecomm.CallInfo; -import android.telecomm.CallServiceDescriptor; - -import java.util.List; - -/** - * Internal remote interface for call service selector adapter. - * - * @see android.telecomm.CallServiceSelectorAdapter - * - * @hide - */ -oneway interface ICallServiceSelectorAdapter { - void setSelectedCallServices( - String callId, - in List<CallServiceDescriptor> selectedCallServiceDescriptors); - - void cancelOutgoingCall(String callId); - - void setHandoffInfo(String callId, in Uri handle, in Bundle extras); -} |