Loading core/java/android/app/MediaRouteButton.java +2 −1 Original line number Diff line number Diff line Loading @@ -217,7 +217,8 @@ public class MediaRouteButton extends View { void updateRemoteIndicator() { final RouteInfo selected = mRouter.getSelectedRoute(mRouteTypes); final boolean isRemote = selected != mRouter.getSystemAudioRoute(); final boolean isConnecting = selected.getStatusCode() == RouteInfo.STATUS_CONNECTING; final boolean isConnecting = selected != null && selected.getStatusCode() == RouteInfo.STATUS_CONNECTING; boolean needsRefresh = false; if (mRemoteActive != isRemote) { Loading core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java +16 −9 Original line number Diff line number Diff line Loading @@ -136,13 +136,14 @@ public class MediaRouteChooserDialogFragment extends DialogFragment { if (mRouter == null) return; final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes); mVolumeIcon.setImageResource( mVolumeIcon.setImageResource(selectedRoute == null || selectedRoute.getPlaybackType() == RouteInfo.PLAYBACK_TYPE_LOCAL ? R.drawable.ic_audio_vol : R.drawable.ic_media_route_on_holo_dark); mIgnoreSliderVolumeChanges = true; if (selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_FIXED) { if (selectedRoute == null || selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_FIXED) { // Disable the slider and show it at max volume. mVolumeSlider.setMax(1); mVolumeSlider.setProgress(1); Loading @@ -160,7 +161,8 @@ public class MediaRouteChooserDialogFragment extends DialogFragment { if (mIgnoreSliderVolumeChanges) return; final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes); if (selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_VARIABLE) { if (selectedRoute != null && selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_VARIABLE) { final int maxVolume = selectedRoute.getVolumeMax(); newValue = Math.max(0, Math.min(newValue, maxVolume)); selectedRoute.requestSetVolume(newValue); Loading Loading @@ -652,15 +654,20 @@ public class MediaRouteChooserDialogFragment extends DialogFragment { public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN && mVolumeSlider.isEnabled()) { mRouter.getSelectedRoute(mRouteTypes).requestUpdateVolume(-1); final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes); if (selectedRoute != null) { selectedRoute.requestUpdateVolume(-1); return true; } } else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP && mVolumeSlider.isEnabled()) { final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes); if (selectedRoute != null) { mRouter.getSelectedRoute(mRouteTypes).requestUpdateVolume(1); return true; } else { return super.onKeyDown(keyCode, event); } } return super.onKeyDown(keyCode, event); } public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN && mVolumeSlider.isEnabled()) { Loading media/java/android/media/MediaRouter.java +14 −2 Original line number Diff line number Diff line Loading @@ -313,13 +313,25 @@ public class MediaRouter { } /** * Return the currently selected route for the given types * Return the currently selected route for any of the given types * * @param type route types * @return the selected route */ public RouteInfo getSelectedRoute(int type) { if (sStatic.mSelectedRoute != null && (sStatic.mSelectedRoute.mSupportedTypes & type) != 0) { // If the selected route supports any of the types supplied, it's still considered // 'selected' for that type. return sStatic.mSelectedRoute; } else if (type == ROUTE_TYPE_USER) { // The caller specifically asked for a user route and the currently selected route // doesn't qualify. return null; } // If the above didn't match and we're not specifically asking for a user route, // consider the default selected. return sStatic.mDefaultAudioVideo; } /** Loading Loading
core/java/android/app/MediaRouteButton.java +2 −1 Original line number Diff line number Diff line Loading @@ -217,7 +217,8 @@ public class MediaRouteButton extends View { void updateRemoteIndicator() { final RouteInfo selected = mRouter.getSelectedRoute(mRouteTypes); final boolean isRemote = selected != mRouter.getSystemAudioRoute(); final boolean isConnecting = selected.getStatusCode() == RouteInfo.STATUS_CONNECTING; final boolean isConnecting = selected != null && selected.getStatusCode() == RouteInfo.STATUS_CONNECTING; boolean needsRefresh = false; if (mRemoteActive != isRemote) { Loading
core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java +16 −9 Original line number Diff line number Diff line Loading @@ -136,13 +136,14 @@ public class MediaRouteChooserDialogFragment extends DialogFragment { if (mRouter == null) return; final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes); mVolumeIcon.setImageResource( mVolumeIcon.setImageResource(selectedRoute == null || selectedRoute.getPlaybackType() == RouteInfo.PLAYBACK_TYPE_LOCAL ? R.drawable.ic_audio_vol : R.drawable.ic_media_route_on_holo_dark); mIgnoreSliderVolumeChanges = true; if (selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_FIXED) { if (selectedRoute == null || selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_FIXED) { // Disable the slider and show it at max volume. mVolumeSlider.setMax(1); mVolumeSlider.setProgress(1); Loading @@ -160,7 +161,8 @@ public class MediaRouteChooserDialogFragment extends DialogFragment { if (mIgnoreSliderVolumeChanges) return; final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes); if (selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_VARIABLE) { if (selectedRoute != null && selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_VARIABLE) { final int maxVolume = selectedRoute.getVolumeMax(); newValue = Math.max(0, Math.min(newValue, maxVolume)); selectedRoute.requestSetVolume(newValue); Loading Loading @@ -652,15 +654,20 @@ public class MediaRouteChooserDialogFragment extends DialogFragment { public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN && mVolumeSlider.isEnabled()) { mRouter.getSelectedRoute(mRouteTypes).requestUpdateVolume(-1); final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes); if (selectedRoute != null) { selectedRoute.requestUpdateVolume(-1); return true; } } else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP && mVolumeSlider.isEnabled()) { final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes); if (selectedRoute != null) { mRouter.getSelectedRoute(mRouteTypes).requestUpdateVolume(1); return true; } else { return super.onKeyDown(keyCode, event); } } return super.onKeyDown(keyCode, event); } public boolean onKeyUp(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN && mVolumeSlider.isEnabled()) { Loading
media/java/android/media/MediaRouter.java +14 −2 Original line number Diff line number Diff line Loading @@ -313,13 +313,25 @@ public class MediaRouter { } /** * Return the currently selected route for the given types * Return the currently selected route for any of the given types * * @param type route types * @return the selected route */ public RouteInfo getSelectedRoute(int type) { if (sStatic.mSelectedRoute != null && (sStatic.mSelectedRoute.mSupportedTypes & type) != 0) { // If the selected route supports any of the types supplied, it's still considered // 'selected' for that type. return sStatic.mSelectedRoute; } else if (type == ROUTE_TYPE_USER) { // The caller specifically asked for a user route and the currently selected route // doesn't qualify. return null; } // If the above didn't match and we're not specifically asking for a user route, // consider the default selected. return sStatic.mDefaultAudioVideo; } /** Loading