Loading core/java/com/android/internal/app/MediaRouteControllerDialog.java +5 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,11 @@ public class MediaRouteControllerDialog extends AlertDialog { @Override public void onClick(DialogInterface dialogInterface, int id) { if (mRoute.isSelected()) { if (mRoute.isBluetooth()) { mRouter.getDefaultRoute().select(); } else { mRouter.getFallbackRoute().select(); } } dismiss(); } Loading media/java/android/media/MediaRouter.java +27 −0 Original line number Diff line number Diff line Loading @@ -731,6 +731,15 @@ public class MediaRouter { return sStatic.mDefaultAudioVideo; } /** * Returns a Bluetooth route if available, otherwise the default route. * @hide */ public RouteInfo getFallbackRoute() { return (sStatic.mBluetoothA2dpRoute != null) ? sStatic.mBluetoothA2dpRoute : sStatic.mDefaultAudioVideo; } /** * @hide for use by framework routing UI */ Loading Loading @@ -913,6 +922,19 @@ public class MediaRouter { (route == btRoute || route == sStatic.mDefaultAudioVideo)) { try { sStatic.mAudioService.setBluetoothA2dpOn(route == btRoute); // TODO: Remove the following logging when no longer needed. if (route != btRoute) { StackTraceElement[] callStack = Thread.currentThread().getStackTrace(); StringBuffer sb = new StringBuffer(); // callStack[3] is the caller of this method. for (int i = 3; i < callStack.length; i++) { StackTraceElement caller = callStack[i]; sb.append(caller.getClassName() + "." + caller.getMethodName() + ":" + caller.getLineNumber()).append(" "); } Log.w(TAG, "Default route is selected while a BT route is available: pkgName=" + sStatic.mPackageName + ", callers=" + sb.toString()); } } catch (RemoteException e) { Log.e(TAG, "Error changing Bluetooth A2DP state", e); } Loading Loading @@ -1998,6 +2020,11 @@ public class MediaRouter { return this == sStatic.mDefaultAudioVideo; } /** @hide */ public boolean isBluetooth() { return this == sStatic.mBluetoothA2dpRoute; } /** @hide */ public void select() { selectRouteStatic(mSupportedTypes, this, true); Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/CastControllerImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -182,7 +182,7 @@ public class CastControllerImpl implements CastController { Log.w(TAG, "Projection is no longer active: " + projection); } } else { mMediaRouter.getDefaultRoute().select(); mMediaRouter.getFallbackRoute().select(); } } Loading services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ public final class MediaProjectionManagerService extends SystemService mProjectionGrant.stop(); } if (mMediaRouteInfo != null) { mMediaRouter.getDefaultRoute().select(); mMediaRouter.getFallbackRoute().select(); } mProjectionToken = projection.asBinder(); mProjectionGrant = projection; Loading Loading
core/java/com/android/internal/app/MediaRouteControllerDialog.java +5 −1 Original line number Diff line number Diff line Loading @@ -142,7 +142,11 @@ public class MediaRouteControllerDialog extends AlertDialog { @Override public void onClick(DialogInterface dialogInterface, int id) { if (mRoute.isSelected()) { if (mRoute.isBluetooth()) { mRouter.getDefaultRoute().select(); } else { mRouter.getFallbackRoute().select(); } } dismiss(); } Loading
media/java/android/media/MediaRouter.java +27 −0 Original line number Diff line number Diff line Loading @@ -731,6 +731,15 @@ public class MediaRouter { return sStatic.mDefaultAudioVideo; } /** * Returns a Bluetooth route if available, otherwise the default route. * @hide */ public RouteInfo getFallbackRoute() { return (sStatic.mBluetoothA2dpRoute != null) ? sStatic.mBluetoothA2dpRoute : sStatic.mDefaultAudioVideo; } /** * @hide for use by framework routing UI */ Loading Loading @@ -913,6 +922,19 @@ public class MediaRouter { (route == btRoute || route == sStatic.mDefaultAudioVideo)) { try { sStatic.mAudioService.setBluetoothA2dpOn(route == btRoute); // TODO: Remove the following logging when no longer needed. if (route != btRoute) { StackTraceElement[] callStack = Thread.currentThread().getStackTrace(); StringBuffer sb = new StringBuffer(); // callStack[3] is the caller of this method. for (int i = 3; i < callStack.length; i++) { StackTraceElement caller = callStack[i]; sb.append(caller.getClassName() + "." + caller.getMethodName() + ":" + caller.getLineNumber()).append(" "); } Log.w(TAG, "Default route is selected while a BT route is available: pkgName=" + sStatic.mPackageName + ", callers=" + sb.toString()); } } catch (RemoteException e) { Log.e(TAG, "Error changing Bluetooth A2DP state", e); } Loading Loading @@ -1998,6 +2020,11 @@ public class MediaRouter { return this == sStatic.mDefaultAudioVideo; } /** @hide */ public boolean isBluetooth() { return this == sStatic.mBluetoothA2dpRoute; } /** @hide */ public void select() { selectRouteStatic(mSupportedTypes, this, true); Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/CastControllerImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -182,7 +182,7 @@ public class CastControllerImpl implements CastController { Log.w(TAG, "Projection is no longer active: " + projection); } } else { mMediaRouter.getDefaultRoute().select(); mMediaRouter.getFallbackRoute().select(); } } Loading
services/core/java/com/android/server/media/projection/MediaProjectionManagerService.java +1 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ public final class MediaProjectionManagerService extends SystemService mProjectionGrant.stop(); } if (mMediaRouteInfo != null) { mMediaRouter.getDefaultRoute().select(); mMediaRouter.getFallbackRoute().select(); } mProjectionToken = projection.asBinder(); mProjectionGrant = projection; Loading