Skip to content

Commit 4dd21c8

Browse files
committed
Volume changes in MediaRouteChooserDialog
Use the max volume reported by the selected route as the max value to set. Change-Id: I9848dfb201387843e7ed398ac61e2d13e14e3f51
1 parent 9ce1ea3 commit 4dd21c8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

core/java/com/android/internal/app/MediaRouteChooserDialogFragment.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public class MediaRouteChooserDialogFragment extends DialogFragment {
7070
};
7171

7272
MediaRouter mRouter;
73-
AudioManager mAudio;
7473
private int mRouteTypes;
7574

7675
private LayoutInflater mInflater;
@@ -98,7 +97,6 @@ public void setLauncherListener(LauncherListener listener) {
9897
public void onAttach(Activity activity) {
9998
super.onAttach(activity);
10099
mRouter = (MediaRouter) activity.getSystemService(Context.MEDIA_ROUTER_SERVICE);
101-
mAudio = (AudioManager) activity.getSystemService(Context.AUDIO_SERVICE);
102100
}
103101

104102
@Override
@@ -150,7 +148,7 @@ void changeVolume(int newValue) {
150148

151149
final RouteInfo selectedRoute = mRouter.getSelectedRoute(mRouteTypes);
152150
if (selectedRoute.getVolumeHandling() == RouteInfo.PLAYBACK_VOLUME_VARIABLE) {
153-
final int maxVolume = mAudio.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
151+
final int maxVolume = selectedRoute.getVolumeMax();
154152
newValue = Math.max(0, Math.min(newValue, maxVolume));
155153
selectedRoute.requestSetVolume(newValue);
156154
}

0 commit comments

Comments
 (0)