Loading media/java/android/media/IMediaRouterService.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ interface IMediaRouterService { MediaRouterClientState getState(IMediaRouterClient client); boolean isPlaybackActive(IMediaRouterClient client); boolean isGlobalBluetoothA2doOn(); void setDiscoveryRequest(IMediaRouterClient client, int routeTypes, boolean activeScan); void setSelectedRoute(IMediaRouterClient client, String routeId, boolean explicit); Loading media/java/android/media/MediaRouter.java +23 −25 Original line number Diff line number Diff line Loading @@ -184,6 +184,8 @@ public class MediaRouter { void updateAudioRoutes(AudioRoutesInfo newRoutes) { boolean audioRoutesChanged = false; boolean forceUseDefaultRoute = false; if (newRoutes.mainType != mCurAudioRoutesInfo.mainType) { mCurAudioRoutesInfo.mainType = newRoutes.mainType; int name; Loading @@ -199,10 +201,16 @@ public class MediaRouter { } mDefaultAudioVideo.mNameResId = name; dispatchRouteChanged(mDefaultAudioVideo); if ((newRoutes.mainType & (AudioRoutesInfo.MAIN_HEADSET | AudioRoutesInfo.MAIN_HEADPHONES | AudioRoutesInfo.MAIN_USB)) != 0) { forceUseDefaultRoute = true; } audioRoutesChanged = true; } if (!TextUtils.equals(newRoutes.bluetoothName, mCurAudioRoutesInfo.bluetoothName)) { forceUseDefaultRoute = false; mCurAudioRoutesInfo.bluetoothName = newRoutes.bluetoothName; if (mCurAudioRoutesInfo.bluetoothName != null) { if (mBluetoothA2dpRoute == null) { Loading Loading @@ -231,30 +239,18 @@ public class MediaRouter { Log.v(TAG, "Audio routes updated: " + newRoutes + ", a2dp=" + isBluetoothA2dpOn()); if (mSelectedRoute == null || mSelectedRoute == mDefaultAudioVideo || mSelectedRoute == mBluetoothA2dpRoute) { selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, getDefaultSystemAudioRoute(), false); if (forceUseDefaultRoute || mBluetoothA2dpRoute == null) { selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mDefaultAudioVideo, false); } else { selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mBluetoothA2dpRoute, false); } } } RouteInfo getDefaultSystemAudioRoute() { boolean globalBluetoothA2doOn = false; try { globalBluetoothA2doOn = mMediaRouterService.isGlobalBluetoothA2doOn(); } catch (RemoteException ex) { Log.e(TAG, "Unable to call isSystemBluetoothA2doOn.", ex); } return (globalBluetoothA2doOn && mBluetoothA2dpRoute != null) ? mBluetoothA2dpRoute : mDefaultAudioVideo; } RouteInfo getCurrentSystemAudioRoute() { return (isBluetoothA2dpOn() && mBluetoothA2dpRoute != null) ? mBluetoothA2dpRoute : mDefaultAudioVideo; } boolean isBluetoothA2dpOn() { try { return mAudioService.isBluetoothA2dpOn(); return mBluetoothA2dpRoute != null && mAudioService.isBluetoothA2dpOn(); } catch (RemoteException e) { Log.e(TAG, "Error querying Bluetooth A2DP state", e); return false; Loading Loading @@ -608,6 +604,7 @@ public class MediaRouter { || mSelectedRoute == null) { return; } Log.v(TAG, "onRestoreRoute() : a2dp=" + isBluetoothA2dpOn()); mSelectedRoute.select(); } } Loading Loading @@ -940,10 +937,12 @@ public class MediaRouter { Log.v(TAG, "Selecting route: " + route); assert(route != null); final RouteInfo oldRoute = sStatic.mSelectedRoute; final RouteInfo currentSystemRoute = sStatic.isBluetoothA2dpOn() ? sStatic.mBluetoothA2dpRoute : sStatic.mDefaultAudioVideo; boolean wasDefaultOrBluetoothRoute = (oldRoute == sStatic.mDefaultAudioVideo || oldRoute == sStatic.mBluetoothA2dpRoute); if (oldRoute == route && (!wasDefaultOrBluetoothRoute || route == sStatic.getCurrentSystemAudioRoute())) { && (!wasDefaultOrBluetoothRoute || route == currentSystemRoute)) { return; } if (!route.matchesTypes(types)) { Loading Loading @@ -1014,8 +1013,7 @@ public class MediaRouter { static void selectDefaultRouteStatic() { // TODO: Be smarter about the route types here; this selects for all valid. if (sStatic.mSelectedRoute != sStatic.mBluetoothA2dpRoute && sStatic.mBluetoothA2dpRoute != null && sStatic.isBluetoothA2dpOn()) { if (sStatic.mSelectedRoute != sStatic.mBluetoothA2dpRoute && sStatic.isBluetoothA2dpOn()) { selectRouteStatic(ROUTE_TYPE_ANY, sStatic.mBluetoothA2dpRoute, false); } else { selectRouteStatic(ROUTE_TYPE_ANY, sStatic.mDefaultAudioVideo, false); Loading services/core/java/com/android/server/media/MediaRouterService.java +1 −9 Original line number Diff line number Diff line Loading @@ -269,14 +269,6 @@ public final class MediaRouterService extends IMediaRouterService.Stub } } // Binder call @Override public boolean isGlobalBluetoothA2doOn() { synchronized (mLock) { return mGlobalBluetoothA2dpOn; } } // Binder call @Override public void setDiscoveryRequest(IMediaRouterClient client, Loading Loading
media/java/android/media/IMediaRouterService.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,6 @@ interface IMediaRouterService { MediaRouterClientState getState(IMediaRouterClient client); boolean isPlaybackActive(IMediaRouterClient client); boolean isGlobalBluetoothA2doOn(); void setDiscoveryRequest(IMediaRouterClient client, int routeTypes, boolean activeScan); void setSelectedRoute(IMediaRouterClient client, String routeId, boolean explicit); Loading
media/java/android/media/MediaRouter.java +23 −25 Original line number Diff line number Diff line Loading @@ -184,6 +184,8 @@ public class MediaRouter { void updateAudioRoutes(AudioRoutesInfo newRoutes) { boolean audioRoutesChanged = false; boolean forceUseDefaultRoute = false; if (newRoutes.mainType != mCurAudioRoutesInfo.mainType) { mCurAudioRoutesInfo.mainType = newRoutes.mainType; int name; Loading @@ -199,10 +201,16 @@ public class MediaRouter { } mDefaultAudioVideo.mNameResId = name; dispatchRouteChanged(mDefaultAudioVideo); if ((newRoutes.mainType & (AudioRoutesInfo.MAIN_HEADSET | AudioRoutesInfo.MAIN_HEADPHONES | AudioRoutesInfo.MAIN_USB)) != 0) { forceUseDefaultRoute = true; } audioRoutesChanged = true; } if (!TextUtils.equals(newRoutes.bluetoothName, mCurAudioRoutesInfo.bluetoothName)) { forceUseDefaultRoute = false; mCurAudioRoutesInfo.bluetoothName = newRoutes.bluetoothName; if (mCurAudioRoutesInfo.bluetoothName != null) { if (mBluetoothA2dpRoute == null) { Loading Loading @@ -231,30 +239,18 @@ public class MediaRouter { Log.v(TAG, "Audio routes updated: " + newRoutes + ", a2dp=" + isBluetoothA2dpOn()); if (mSelectedRoute == null || mSelectedRoute == mDefaultAudioVideo || mSelectedRoute == mBluetoothA2dpRoute) { selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, getDefaultSystemAudioRoute(), false); if (forceUseDefaultRoute || mBluetoothA2dpRoute == null) { selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mDefaultAudioVideo, false); } else { selectRouteStatic(ROUTE_TYPE_LIVE_AUDIO, mBluetoothA2dpRoute, false); } } } RouteInfo getDefaultSystemAudioRoute() { boolean globalBluetoothA2doOn = false; try { globalBluetoothA2doOn = mMediaRouterService.isGlobalBluetoothA2doOn(); } catch (RemoteException ex) { Log.e(TAG, "Unable to call isSystemBluetoothA2doOn.", ex); } return (globalBluetoothA2doOn && mBluetoothA2dpRoute != null) ? mBluetoothA2dpRoute : mDefaultAudioVideo; } RouteInfo getCurrentSystemAudioRoute() { return (isBluetoothA2dpOn() && mBluetoothA2dpRoute != null) ? mBluetoothA2dpRoute : mDefaultAudioVideo; } boolean isBluetoothA2dpOn() { try { return mAudioService.isBluetoothA2dpOn(); return mBluetoothA2dpRoute != null && mAudioService.isBluetoothA2dpOn(); } catch (RemoteException e) { Log.e(TAG, "Error querying Bluetooth A2DP state", e); return false; Loading Loading @@ -608,6 +604,7 @@ public class MediaRouter { || mSelectedRoute == null) { return; } Log.v(TAG, "onRestoreRoute() : a2dp=" + isBluetoothA2dpOn()); mSelectedRoute.select(); } } Loading Loading @@ -940,10 +937,12 @@ public class MediaRouter { Log.v(TAG, "Selecting route: " + route); assert(route != null); final RouteInfo oldRoute = sStatic.mSelectedRoute; final RouteInfo currentSystemRoute = sStatic.isBluetoothA2dpOn() ? sStatic.mBluetoothA2dpRoute : sStatic.mDefaultAudioVideo; boolean wasDefaultOrBluetoothRoute = (oldRoute == sStatic.mDefaultAudioVideo || oldRoute == sStatic.mBluetoothA2dpRoute); if (oldRoute == route && (!wasDefaultOrBluetoothRoute || route == sStatic.getCurrentSystemAudioRoute())) { && (!wasDefaultOrBluetoothRoute || route == currentSystemRoute)) { return; } if (!route.matchesTypes(types)) { Loading Loading @@ -1014,8 +1013,7 @@ public class MediaRouter { static void selectDefaultRouteStatic() { // TODO: Be smarter about the route types here; this selects for all valid. if (sStatic.mSelectedRoute != sStatic.mBluetoothA2dpRoute && sStatic.mBluetoothA2dpRoute != null && sStatic.isBluetoothA2dpOn()) { if (sStatic.mSelectedRoute != sStatic.mBluetoothA2dpRoute && sStatic.isBluetoothA2dpOn()) { selectRouteStatic(ROUTE_TYPE_ANY, sStatic.mBluetoothA2dpRoute, false); } else { selectRouteStatic(ROUTE_TYPE_ANY, sStatic.mDefaultAudioVideo, false); Loading
services/core/java/com/android/server/media/MediaRouterService.java +1 −9 Original line number Diff line number Diff line Loading @@ -269,14 +269,6 @@ public final class MediaRouterService extends IMediaRouterService.Stub } } // Binder call @Override public boolean isGlobalBluetoothA2doOn() { synchronized (mLock) { return mGlobalBluetoothA2dpOn; } } // Binder call @Override public void setDiscoveryRequest(IMediaRouterClient client, Loading