Loading services/core/java/com/android/server/media/AudioManagerRouteController.java +4 −3 Original line number Diff line number Diff line Loading @@ -328,7 +328,7 @@ import java.util.concurrent.CopyOnWriteArrayList; if (com.android.media.flags.Flags.enableOutputSwitcherPersonalAudioSharing()) { // We need to stop broadcast when we transfer to another route stopBroadcastIfCurrentlySelected(requestId); stopBroadcastForTransferIfCurrentlySelected(requestId); } MediaRoute2InfoHolder mediaRoute2InfoHolder; Loading Loading @@ -390,12 +390,13 @@ import java.util.concurrent.CopyOnWriteArrayList; mHandler.post(() -> mBluetoothRouteController.removeRouteFromBroadcast(routeId)); } private void stopBroadcastIfCurrentlySelected(long requestId) { private void stopBroadcastForTransferIfCurrentlySelected(long requestId) { if (!currentOutputIsBLEBroadcast()) { return; } mHandler.post(mBluetoothRouteController::stopBroadcast); // TODO: b/430200199 - Setting a correct routeId mHandler.post(() -> mBluetoothRouteController.stopBroadcast(/* routeId= */ null)); } @RequiresPermission( Loading services/core/java/com/android/server/media/BluetoothDeviceRoutesManager.java +8 −0 Original line number Diff line number Diff line Loading @@ -301,6 +301,14 @@ import java.util.stream.Collectors; mBluetoothProfileMonitor.stopBroadcast(); } /** * Trigger {@link BluetoothProfileMonitor} to stop the broadcast, optionally making a new BT * device active. */ protected void stopBroadcast(@Nullable String routeId) { mBluetoothProfileMonitor.stopBroadcast(routeId); } /** * Obtains a list of selected bluetooth route infos. * Loading services/core/java/com/android/server/media/BluetoothProfileMonitor.java +31 −4 Original line number Diff line number Diff line Loading @@ -237,13 +237,40 @@ import java.util.concurrent.ThreadLocalRandom; mBroadcastProfile.startBroadcast(settings); } /** Stops the broadcast. */ /** Stops the broadcast */ public synchronized void stopBroadcast() { if (mBroadcastProfile != null) { if (mBroadcastProfile == null) { Slog.e(TAG, "Fail to stop broadcast, LeBroadcast is null"); return; } mBroadcastProfile.stopBroadcast(mBroadcastId); } else { } /** * Stops the broadcast, optionally making a new BT device active. * * <p>This method is expected to use this ID to determine which unicast fallback group should be * set the broadcast stops. * * @param routeId id of the bluetooth route that should become active once the broadcast stops, * or null if no BT route should become active once broadcast stops. */ public synchronized void stopBroadcast(@Nullable String routeId) { if (mBroadcastProfile == null) { Slog.e(TAG, "Fail to stop broadcast, LeBroadcast is null"); return; } if (routeId == null) { if (mLeAudioProfile == null) { Slog.e(TAG, "Fail to set fall back group, LeProfile is null"); } else { // TODO: b/430200199 - Map the route id to group id if not null, so that // the target BT route becomes active. mLeAudioProfile.setBroadcastToUnicastFallbackGroup( BluetoothLeAudio.GROUP_ID_INVALID); } } mBroadcastProfile.stopBroadcast(mBroadcastId); } /** Loading Loading
services/core/java/com/android/server/media/AudioManagerRouteController.java +4 −3 Original line number Diff line number Diff line Loading @@ -328,7 +328,7 @@ import java.util.concurrent.CopyOnWriteArrayList; if (com.android.media.flags.Flags.enableOutputSwitcherPersonalAudioSharing()) { // We need to stop broadcast when we transfer to another route stopBroadcastIfCurrentlySelected(requestId); stopBroadcastForTransferIfCurrentlySelected(requestId); } MediaRoute2InfoHolder mediaRoute2InfoHolder; Loading Loading @@ -390,12 +390,13 @@ import java.util.concurrent.CopyOnWriteArrayList; mHandler.post(() -> mBluetoothRouteController.removeRouteFromBroadcast(routeId)); } private void stopBroadcastIfCurrentlySelected(long requestId) { private void stopBroadcastForTransferIfCurrentlySelected(long requestId) { if (!currentOutputIsBLEBroadcast()) { return; } mHandler.post(mBluetoothRouteController::stopBroadcast); // TODO: b/430200199 - Setting a correct routeId mHandler.post(() -> mBluetoothRouteController.stopBroadcast(/* routeId= */ null)); } @RequiresPermission( Loading
services/core/java/com/android/server/media/BluetoothDeviceRoutesManager.java +8 −0 Original line number Diff line number Diff line Loading @@ -301,6 +301,14 @@ import java.util.stream.Collectors; mBluetoothProfileMonitor.stopBroadcast(); } /** * Trigger {@link BluetoothProfileMonitor} to stop the broadcast, optionally making a new BT * device active. */ protected void stopBroadcast(@Nullable String routeId) { mBluetoothProfileMonitor.stopBroadcast(routeId); } /** * Obtains a list of selected bluetooth route infos. * Loading
services/core/java/com/android/server/media/BluetoothProfileMonitor.java +31 −4 Original line number Diff line number Diff line Loading @@ -237,13 +237,40 @@ import java.util.concurrent.ThreadLocalRandom; mBroadcastProfile.startBroadcast(settings); } /** Stops the broadcast. */ /** Stops the broadcast */ public synchronized void stopBroadcast() { if (mBroadcastProfile != null) { if (mBroadcastProfile == null) { Slog.e(TAG, "Fail to stop broadcast, LeBroadcast is null"); return; } mBroadcastProfile.stopBroadcast(mBroadcastId); } else { } /** * Stops the broadcast, optionally making a new BT device active. * * <p>This method is expected to use this ID to determine which unicast fallback group should be * set the broadcast stops. * * @param routeId id of the bluetooth route that should become active once the broadcast stops, * or null if no BT route should become active once broadcast stops. */ public synchronized void stopBroadcast(@Nullable String routeId) { if (mBroadcastProfile == null) { Slog.e(TAG, "Fail to stop broadcast, LeBroadcast is null"); return; } if (routeId == null) { if (mLeAudioProfile == null) { Slog.e(TAG, "Fail to set fall back group, LeProfile is null"); } else { // TODO: b/430200199 - Map the route id to group id if not null, so that // the target BT route becomes active. mLeAudioProfile.setBroadcastToUnicastFallbackGroup( BluetoothLeAudio.GROUP_ID_INVALID); } } mBroadcastProfile.stopBroadcast(mBroadcastId); } /** Loading