From 2eedc1fe648d9668b1607bfbbc15e164e7d08402 Mon Sep 17 00:00:00 2001 From: Hyundo Moon Date: Thu, 3 Jun 2021 16:24:34 +0900 Subject: [PATCH] MediaRouter: Set initial mIsBluetoothA2dpOn value When BT is connected before MediaRouter is initialized, the mIsBluetoothA2dpOn is not set as true. Since the value is false, the 'currentSystemRoute' variable in MediaRouter.selectRouteStatic() is always default route. This leads to skip selectRoute(defaultRoute) which is called by apps. The value is always false and not renewed, until audio routes changed. This results apps cannot make sounds through phone speaker. The CL fixes the issue by correctly assigning the value when MediaRouter is initialized. Bug: 189176702 Test: GMM can make sound via phone speaker. Change-Id: I4a83f9441a8b3165b7dd668aeef12c25fe3817c0 --- media/java/android/media/MediaRouter.java | 1 + 1 file changed, 1 insertion(+) diff --git a/media/java/android/media/MediaRouter.java b/media/java/android/media/MediaRouter.java index 4c8a8fa4a5544..1a2a1aee0eb32 100644 --- a/media/java/android/media/MediaRouter.java +++ b/media/java/android/media/MediaRouter.java @@ -185,6 +185,7 @@ public class MediaRouter { AudioRoutesInfo newAudioRoutes = null; try { + mIsBluetoothA2dpOn = mAudioService.isBluetoothA2dpOn(); newAudioRoutes = mAudioService.startWatchingRoutes(mAudioRoutesObserver); } catch (RemoteException e) { }