Revert "Remove CallServiceProviderAdapter and replace with CallServiceLookupResponse."
This reverts commit 753fc58932e976086069bacb3e5252332960644b. Change-Id: Ie17b4918fa404eb768c0f3ce5109d6cc8b2d1da8
This commit is contained in:
committed by
Evan Charlton
parent
6fbb1b73f8
commit
6fee2ea8f8
@@ -279,8 +279,8 @@ LOCAL_SRC_FILES += \
|
||||
media/java/android/media/IRingtonePlayer.aidl \
|
||||
telecomm/java/android/telecomm/ICallService.aidl \
|
||||
telecomm/java/android/telecomm/ICallServiceAdapter.aidl \
|
||||
telecomm/java/android/telecomm/ICallServiceLookupResponse.aidl \
|
||||
telecomm/java/android/telecomm/ICallServiceProvider.aidl \
|
||||
telecomm/java/android/telecomm/ICallServiceProviderAdapter.aidl \
|
||||
telephony/java/com/android/internal/telephony/IPhoneStateListener.aidl \
|
||||
telephony/java/com/android/internal/telephony/IPhoneSubInfo.aidl \
|
||||
telephony/java/com/android/internal/telephony/ITelephony.aidl \
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user