diff options
author | Santos Cordon <santoscordon@google.com> | 2014-01-10 04:20:34 +0000 |
---|---|---|
committer | Evan Charlton <evanc@google.com> | 2014-02-20 15:12:49 -0800 |
commit | 6fee2ea8f887e32d4c4a8c35b0ff00ea7eeb2bb3 (patch) | |
tree | 53da03499a8aaea0e4b481da68c866a2733ee8ee /telecomm | |
parent | 6fbb1b73f82da0e7fe1244e4a44dea3c3c163997 (diff) | |
download | frameworks_base-6fee2ea8f887e32d4c4a8c35b0ff00ea7eeb2bb3.zip frameworks_base-6fee2ea8f887e32d4c4a8c35b0ff00ea7eeb2bb3.tar.gz frameworks_base-6fee2ea8f887e32d4c4a8c35b0ff00ea7eeb2bb3.tar.bz2 |
Revert "Remove CallServiceProviderAdapter and replace with CallServiceLookupResponse."
This reverts commit 753fc58932e976086069bacb3e5252332960644b.
Change-Id: Ie17b4918fa404eb768c0f3ce5109d6cc8b2d1da8
Diffstat (limited to 'telecomm')
4 files changed, 71 insertions, 69 deletions
diff --git a/telecomm/java/android/telecomm/CallServiceProvider.java b/telecomm/java/android/telecomm/CallServiceProvider.java index f5fa1d1..01e1271 100644 --- a/telecomm/java/android/telecomm/CallServiceProvider.java +++ b/telecomm/java/android/telecomm/CallServiceProvider.java @@ -21,11 +21,8 @@ import android.content.Intent; import android.os.Handler; import android.os.IBinder; import android.os.Message; -import android.os.RemoteException; import android.telecomm.ICallServiceProvider; -import android.telecomm.ICallServiceLookupResponse; -import android.util.Log; /** * Base implementation of CallServiceProvider service which implements ICallServiceProvider. @@ -36,9 +33,7 @@ import android.util.Log; * about how this can be used. * @hide */ -public abstract class CallServiceProvider extends Service implements ICallServiceProvider { - /** Used to identify log entries by this class. */ - private static final String TAG = CallServiceProvider.class.getSimpleName(); +public abstract class CallServiceProvider extends Service { /** * Default Handler used to consolidate binder method calls onto a single thread. @@ -47,12 +42,8 @@ public abstract class CallServiceProvider extends Service implements ICallServic @Override public void handleMessage(Message msg) { switch (msg.what) { - case MSG_GET_CALL_SERVICES: - try { - lookupCallServices((ICallServiceLookupResponse) msg.obj); - } catch (RemoteException e) { - Log.e(TAG, "Remote exception on lookupCallServices().", e); - } + case MSG_SET_CALL_SERVICE_PROVIDER_ADAPTER: + setCallServiceProviderAdapter((ICallServiceProviderAdapter) msg.obj); break; default: break; @@ -64,13 +55,15 @@ public abstract class CallServiceProvider extends Service implements ICallServic * Default ICallServiceProvider implementation provided to CallsManager via {@link #onBind}. */ private final class CallServiceProviderWrapper extends ICallServiceProvider.Stub { - - /** {@inheritDoc} */ @Override - public void lookupCallServices(ICallServiceLookupResponse callServiceLookupResponse) { - mMessageHandler.obtainMessage(MSG_GET_CALL_SERVICES, callServiceLookupResponse) - .sendToTarget(); + public void setCallServiceProviderAdapter( + ICallServiceProviderAdapter CallServiceProviderAdapter) { + mMessageHandler.obtainMessage(MSG_SET_CALL_SERVICE_PROVIDER_ADAPTER, + CallServiceProviderAdapter).sendToTarget(); } + + @Override + public void initiateDiscoveryProtocol() {} } // Only used internally by this class. @@ -78,7 +71,7 @@ public abstract class CallServiceProvider extends Service implements ICallServic // in conjunction with {@link #mMessageHandler} to ensure that all callbacks are handled on a // single thread. Keeping it on a single thread allows CallService implementations to avoid // needing multi-threaded code in their own callback routines. - private static final int MSG_GET_CALL_SERVICES = 1; + private static final int MSG_SET_CALL_SERVICE_PROVIDER_ADAPTER = 1; /** * Message handler for consolidating binder callbacks onto a single thread. @@ -104,4 +97,14 @@ public abstract class CallServiceProvider extends Service implements ICallServic public IBinder onBind(Intent intent) { return mBinder; } + + /** + * Sets an implementation of ICallServiceProviderAdapter for adding providing instances of + * ICallService. + * TODO(santoscordon): Should we not reference ICallServiceProviderAdapter directly from here? + * Should we wrap that in a wrapper like we do for CallServiceProvider/ICallServiceProvider? + * @param callServiceAdapter Adapter object for communicating call to CallsManager + */ + public abstract void setCallServiceProviderAdapter( + ICallServiceProviderAdapter CallServiceProviderAdapter); } diff --git a/telecomm/java/android/telecomm/ICallServiceLookupResponse.aidl b/telecomm/java/android/telecomm/ICallServiceLookupResponse.aidl deleted file mode 100644 index 2327c64..0000000 --- a/telecomm/java/android/telecomm/ICallServiceLookupResponse.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 android.telecomm; - -import android.os.Bundle; - -/** - * Used by {@link ICallServiceProvider} to return a list of {@link ICallService} implementations or - * an errorCode in case of error. - */ -oneway interface ICallServiceLookupResponse { - /** - * Receives the list of {@link ICallServices} as a data value in the bundle parameter. - * TODO(santoscordon): Needs more specifics about the data key used for the list. - * - * @param bundle Container for the list of call services. - */ - void onResult(in Bundle bundle); - - /** - * Receives error code upon failure in retrieving the list of call services. - * TODO(santoscordon): Needs list of potential error codes. Also, do we really need this - * method or can we return codes as part of onResult? - * - * @param errorCode Error code describing the error condition. - */ - void onError(int errorCode); -} diff --git a/telecomm/java/android/telecomm/ICallServiceProvider.aidl b/telecomm/java/android/telecomm/ICallServiceProvider.aidl index 2e2610c..1bd8d1f 100644 --- a/telecomm/java/android/telecomm/ICallServiceProvider.aidl +++ b/telecomm/java/android/telecomm/ICallServiceProvider.aidl @@ -16,7 +16,7 @@ package android.telecomm; -import android.telecomm.ICallServiceLookupResponse; +import android.telecomm.ICallServiceProviderAdapter; /** * Interface for applications interested in providing call-service implementations. Only used in @@ -24,8 +24,9 @@ import android.telecomm.ICallServiceLookupResponse; * decided dynamically (unlike incoming call scenario where the call-service is known). * * Intended usage at time of writing is: Call intent received by the CallsManager, which in turn - * gathers and binds all ICallServiceProvider implementations (using the framework). Once bound, the - * CallsManager invokes the lookupCallServices API of each bound provider and waits until + * gathers and binds all ICallServiceProvider implementations (using the framework). The actual + * bind is between each CallServiceProvider and the CallServiceProviderAdapter. Once bound, the + * CallsManager invokes the initiateDiscoveryProtocol API of each bound provider and waits until * either all providers reply (asynchronously) or some timeout is met. The resulted list is then * processed by the CallsManager and its helpers (potentially requesting input from the user) to * identify the best CallService. The user should obviously be notified upon zero candidates as @@ -35,12 +36,17 @@ import android.telecomm.ICallServiceLookupResponse; oneway interface ICallServiceProvider { /** - * Initiates the process to retrieve the list of {@link ICallService}s implemented by - * this provider. - * TODO(santoscordon): Needs comments on how to populate the list within - * ICallServiceLookupResponse and how to handle error conditions. + * Sets an implementation of ICallServiceProviderAdapter to allow call-service providers to + * communicate with the CallsManager. * - * @param response The response object through which the list of call services is sent. + * @param callServiceProviderAdapter The interface through which {@link ICallService} + * implementations are passed to CallsManager. */ - void lookupCallServices(in ICallServiceLookupResponse response); + void setCallServiceProviderAdapter(in ICallServiceProviderAdapter callServiceProviderAdapter); + + /** + * Provides the application with the opportunity to "register" ICallServiceProvider + * implementations with the CallsManager for the purpose of issuing outgoing calls. + */ + void initiateDiscoveryProtocol(); } diff --git a/telecomm/java/android/telecomm/ICallServiceProviderAdapter.aidl b/telecomm/java/android/telecomm/ICallServiceProviderAdapter.aidl new file mode 100644 index 0000000..ec88a06 --- /dev/null +++ b/telecomm/java/android/telecomm/ICallServiceProviderAdapter.aidl @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2013 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.telecomm.ICallService; + +/** + * Provides ICallServiceProvider implementations with the relevant CallsManager APIs. + * @hide + */ +oneway interface ICallServiceProviderAdapter { + + /** + * Provides the CallsManager with the services made available by this application. + * + * @param callServices The relevant services to make the CallsManager aware of. Parameter is + * a list of IBinder which can be cast to ICallService. + * NOTE: IBinder is required by AIDL processor when passing a list of interfaces. + */ + void registerCallServices(in List<IBinder> callServices); +} |