Loading media/java/android/media/IMediaRouterClient.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -23,5 +23,4 @@ oneway interface IMediaRouterClient { void onStateChanged(); void onRestoreRoute(); void onGroupRouteSelected(String routeId); void onGlobalA2dpChanged(boolean a2dpOn); } media/java/android/media/MediaRouter.java +6 −19 Original line number Diff line number Diff line Loading @@ -654,10 +654,13 @@ public class MediaRouter { final class Client extends IMediaRouterClient.Stub { @Override public void onStateChanged() { mHandler.post(() -> { mHandler.post(new Runnable() { @Override public void run() { if (Client.this == mClient) { updateClientState(); } } }); } Loading Loading @@ -690,22 +693,6 @@ public class MediaRouter { } }); } // Called when the selection of a connected device (phone speaker or BT devices) // is changed. @Override public void onGlobalA2dpChanged(boolean a2dpOn) { mHandler.post(() -> { if (mSelectedRoute == null) { return; } if (mSelectedRoute.isDefault() && a2dpOn) { setSelectedRoute(mBluetoothA2dpRoute, /*explicit=*/false); } else if (mSelectedRoute.isBluetooth() && !a2dpOn) { setSelectedRoute(mDefaultAudioVideo, /*explicit=*/false); } }); } } } Loading services/core/java/com/android/server/media/MediaRouterService.java +0 −18 Original line number Diff line number Diff line Loading @@ -903,26 +903,8 @@ public final class MediaRouterService extends IMediaRouterService.Stub if (intent.getAction().equals(BluetoothA2dp.ACTION_ACTIVE_DEVICE_CHANGED)) { BluetoothDevice btDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); synchronized (mLock) { boolean wasA2dpOn = mGlobalBluetoothA2dpOn; mActiveBluetoothDevice = btDevice; mGlobalBluetoothA2dpOn = btDevice != null; if (wasA2dpOn != mGlobalBluetoothA2dpOn) { Slog.d(TAG, "GlobalBluetoothA2dpOn is changed to '" + mGlobalBluetoothA2dpOn + "'"); UserRecord userRecord = mUserRecords.get(mCurrentUserId); if (userRecord != null) { for (ClientRecord cr : userRecord.mClientRecords) { // mSelectedRouteId will be null for BT and phone speaker. if (cr.mSelectedRouteId == null) { try { cr.mClient.onGlobalA2dpChanged(mGlobalBluetoothA2dpOn); } catch (RemoteException e) { // Ignore exception } } } } } } } } Loading Loading
media/java/android/media/IMediaRouterClient.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -23,5 +23,4 @@ oneway interface IMediaRouterClient { void onStateChanged(); void onRestoreRoute(); void onGroupRouteSelected(String routeId); void onGlobalA2dpChanged(boolean a2dpOn); }
media/java/android/media/MediaRouter.java +6 −19 Original line number Diff line number Diff line Loading @@ -654,10 +654,13 @@ public class MediaRouter { final class Client extends IMediaRouterClient.Stub { @Override public void onStateChanged() { mHandler.post(() -> { mHandler.post(new Runnable() { @Override public void run() { if (Client.this == mClient) { updateClientState(); } } }); } Loading Loading @@ -690,22 +693,6 @@ public class MediaRouter { } }); } // Called when the selection of a connected device (phone speaker or BT devices) // is changed. @Override public void onGlobalA2dpChanged(boolean a2dpOn) { mHandler.post(() -> { if (mSelectedRoute == null) { return; } if (mSelectedRoute.isDefault() && a2dpOn) { setSelectedRoute(mBluetoothA2dpRoute, /*explicit=*/false); } else if (mSelectedRoute.isBluetooth() && !a2dpOn) { setSelectedRoute(mDefaultAudioVideo, /*explicit=*/false); } }); } } } Loading
services/core/java/com/android/server/media/MediaRouterService.java +0 −18 Original line number Diff line number Diff line Loading @@ -903,26 +903,8 @@ public final class MediaRouterService extends IMediaRouterService.Stub if (intent.getAction().equals(BluetoothA2dp.ACTION_ACTIVE_DEVICE_CHANGED)) { BluetoothDevice btDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); synchronized (mLock) { boolean wasA2dpOn = mGlobalBluetoothA2dpOn; mActiveBluetoothDevice = btDevice; mGlobalBluetoothA2dpOn = btDevice != null; if (wasA2dpOn != mGlobalBluetoothA2dpOn) { Slog.d(TAG, "GlobalBluetoothA2dpOn is changed to '" + mGlobalBluetoothA2dpOn + "'"); UserRecord userRecord = mUserRecords.get(mCurrentUserId); if (userRecord != null) { for (ClientRecord cr : userRecord.mClientRecords) { // mSelectedRouteId will be null for BT and phone speaker. if (cr.mSelectedRouteId == null) { try { cr.mClient.onGlobalA2dpChanged(mGlobalBluetoothA2dpOn); } catch (RemoteException e) { // Ignore exception } } } } } } } } Loading