Update Telecom APIs to include multi-hfp

* Add bluetooth devices to CallAudioState
* Add methods for specifying a bluetooth device to InCallService
* Add methods for specifying a bluetooth device to Connection (for
self-managed connections)

Bug: 64767509
Test: unit tests
Change-Id: I286b19b423dc2ee417dbc90eda7e8055b2da2444
This commit is contained in:
Hall Liu
2017-11-07 17:59:28 -08:00
parent 3ddf22e69c
commit a98f58b5c1
14 changed files with 188 additions and 23 deletions

View File

@@ -25,6 +25,7 @@ import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.app.Notification;
import android.bluetooth.BluetoothDevice;
import android.content.Intent;
import android.hardware.camera2.CameraManager;
import android.net.Uri;
@@ -819,7 +820,7 @@ public abstract class Connection extends Conferenceable {
public void onConnectionEvent(Connection c, String event, Bundle extras) {}
/** @hide */
public void onConferenceSupportedChanged(Connection c, boolean isConferenceSupported) {}
public void onAudioRouteChanged(Connection c, int audioRoute) {}
public void onAudioRouteChanged(Connection c, int audioRoute, String bluetoothAddress) {}
public void onRttInitiationSuccess(Connection c) {}
public void onRttInitiationFailure(Connection c, int reason) {}
public void onRttSessionRemotelyTerminated(Connection c) {}
@@ -2576,7 +2577,29 @@ public abstract class Connection extends Conferenceable {
*/
public final void setAudioRoute(int route) {
for (Listener l : mListeners) {
l.onAudioRouteChanged(this, route);
l.onAudioRouteChanged(this, route, null);
}
}
/**
*
* Request audio routing to a specific bluetooth device. Calling this method may result in
* the device routing audio to a different bluetooth device than the one specified if the
* bluetooth stack is unable to route audio to the requested device.
* A list of available devices can be obtained via
* {@link CallAudioState#getSupportedBluetoothDevices()}
*
* <p>
* Used by self-managed {@link ConnectionService}s which wish to use bluetooth audio for a
* self-managed {@link Connection} (see {@link PhoneAccount#CAPABILITY_SELF_MANAGED}.)
* <p>
* See also {@link InCallService#requestBluetoothAudio(String)}
* @param bluetoothAddress The address of the bluetooth device to connect to, as returned by
* {@link BluetoothDevice#getAddress()}.
*/
public void requestBluetoothAudio(@NonNull String bluetoothAddress) {
for (Listener l : mListeners) {
l.onAudioRouteChanged(this, CallAudioState.ROUTE_BLUETOOTH, bluetoothAddress);
}
}