Merge "MediaRouter: Route setBluetoothA2dpOn() via MediaRouterService" into sc-qpr1-dev am: 2c7ec2cbf5

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16044773

Change-Id: I017be1b10677f78ee7f5b290a13eab376c4e0615
This commit is contained in:
Hyundo Moon
2021-10-20 02:27:48 +00:00
committed by Automerger Merge Worker
3 changed files with 22 additions and 1 deletions

View File

@@ -39,6 +39,7 @@ interface IMediaRouterService {
MediaRouterClientState getState(IMediaRouterClient client);
boolean isPlaybackActive(IMediaRouterClient client);
void setBluetoothA2dpOn(IMediaRouterClient client, boolean on);
void setDiscoveryRequest(IMediaRouterClient client, int routeTypes, boolean activeScan);
void setSelectedRoute(IMediaRouterClient client, String routeId, boolean explicit);
void requestSetVolume(IMediaRouterClient client, String routeId, int volume);

View File

@@ -1087,7 +1087,8 @@ public class MediaRouter {
&& (types & ROUTE_TYPE_LIVE_AUDIO) != 0
&& (route.isBluetooth() || route.isDefault())) {
try {
sStatic.mAudioService.setBluetoothA2dpOn(route.isBluetooth());
sStatic.mMediaRouterService.setBluetoothA2dpOn(sStatic.mClient,
route.isBluetooth());
} catch (RemoteException e) {
Log.e(TAG, "Error changing Bluetooth A2DP state", e);
}

View File

@@ -336,6 +336,25 @@ public final class MediaRouterService extends IMediaRouterService.Stub
}
}
// Binder call
@Override
public void setBluetoothA2dpOn(IMediaRouterClient client, boolean on) {
if (client == null) {
throw new IllegalArgumentException("client must not be null");
}
final long token = Binder.clearCallingIdentity();
try {
synchronized (mLock) {
mAudioService.setBluetoothA2dpOn(on);
}
} catch (RemoteException ex) {
Slog.w(TAG, "RemoteException while calling setBluetoothA2dpOn. on=" + on);
} finally {
Binder.restoreCallingIdentity(token);
}
}
// Binder call
@Override
public void setDiscoveryRequest(IMediaRouterClient client,