Loading media/java/android/media/AudioManagerInternal.java +4 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,10 @@ import com.android.server.LocalServices; */ public abstract class AudioManagerInternal { public abstract void adjustSuggestedStreamVolumeForUid(int streamType, int direction, int flags, String callingPackage, int uid); public abstract void adjustStreamVolumeForUid(int streamType, int direction, int flags, String callingPackage, int uid); Loading media/java/android/media/AudioService.java +16 −1 Original line number Diff line number Diff line Loading @@ -904,6 +904,12 @@ public class AudioService extends IAudioService.Stub { /** @see AudioManager#adjustVolume(int, int) */ public void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags, String callingPackage) { adjustSuggestedStreamVolume(direction, suggestedStreamType, flags, callingPackage, Binder.getCallingUid()); } private void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags, String callingPackage, int uid) { if (DEBUG_VOL) Log.d(TAG, "adjustSuggestedStreamVolume() stream="+suggestedStreamType + ", flags=" + flags); int streamType; Loading @@ -928,7 +934,7 @@ public class AudioService extends IAudioService.Stub { if (DEBUG_VOL) Log.d(TAG, "Volume controller suppressed adjustment"); } adjustStreamVolume(streamType, direction, flags, callingPackage); adjustStreamVolume(streamType, direction, flags, callingPackage, uid); } /** @see AudioManager#adjustStreamVolume(int, int, int) */ Loading Loading @@ -5348,6 +5354,15 @@ public class AudioService extends IAudioService.Stub { * LocalServices. */ final class AudioServiceInternal extends AudioManagerInternal { @Override public void adjustSuggestedStreamVolumeForUid(int streamType, int direction, int flags, String callingPackage, int uid) { // direction and stream type swap here because the public // adjustSuggested has a different order than the other methods. adjustSuggestedStreamVolume(direction, streamType, flags, callingPackage, uid); } @Override public void adjustStreamVolumeForUid(int streamType, int direction, int flags, String callingPackage, int uid) { Loading services/core/java/com/android/server/media/MediaSessionRecord.java +15 −4 Original line number Diff line number Diff line Loading @@ -229,8 +229,14 @@ public class MediaSessionRecord implements IBinder.DeathRecipient { * {@link AudioManager#ADJUST_SAME}. * * @param direction The direction to adjust volume in. * @param flags Any of the flags from {@link AudioManager}. * @param packageName The package that made the original volume request. * @param uid The uid that made the original volume request. * @param useSuggested True to use adjustSuggestedStreamVolume instead of * adjustStreamVolume. */ public void adjustVolume(int direction, int flags, String packageName, int uid) { public void adjustVolume(int direction, int flags, String packageName, int uid, boolean useSuggested) { if (isPlaybackActive(false) || hasFlag(MediaSession.FLAG_EXCLUSIVE_GLOBAL_PRIORITY)) { flags &= ~AudioManager.FLAG_PLAY_SOUND; } Loading @@ -241,8 +247,13 @@ public class MediaSessionRecord implements IBinder.DeathRecipient { } if (mVolumeType == PlaybackInfo.PLAYBACK_TYPE_LOCAL) { int stream = AudioAttributes.toLegacyStreamType(mAudioAttrs); mAudioManagerInternal.adjustStreamVolumeForUid(stream, direction, flags, packageName, uid); if (useSuggested) { mAudioManagerInternal.adjustSuggestedStreamVolumeForUid(stream, direction, flags, packageName, uid); } else { mAudioManagerInternal.adjustStreamVolumeForUid(stream, direction, flags, packageName, uid); } } else { if (mVolumeControlType == VolumeProvider.VOLUME_CONTROL_FIXED) { // Nothing to do, the volume cannot be changed Loading Loading @@ -1020,7 +1031,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient { int uid = Binder.getCallingUid(); final long token = Binder.clearCallingIdentity(); try { MediaSessionRecord.this.adjustVolume(direction, flags, packageName, uid); MediaSessionRecord.this.adjustVolume(direction, flags, packageName, uid, false); } finally { Binder.restoreCallingIdentity(token); } Loading services/core/java/com/android/server/media/MediaSessionService.java +1 −1 Original line number Diff line number Diff line Loading @@ -814,7 +814,7 @@ public class MediaSessionService extends SystemService implements Monitor { } } else { session.adjustVolume(direction, flags, getContext().getPackageName(), UserHandle.myUserId()); UserHandle.myUserId(), true); if (session.getPlaybackType() == PlaybackInfo.PLAYBACK_TYPE_REMOTE && mRvc != null) { try { Loading Loading
media/java/android/media/AudioManagerInternal.java +4 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,10 @@ import com.android.server.LocalServices; */ public abstract class AudioManagerInternal { public abstract void adjustSuggestedStreamVolumeForUid(int streamType, int direction, int flags, String callingPackage, int uid); public abstract void adjustStreamVolumeForUid(int streamType, int direction, int flags, String callingPackage, int uid); Loading
media/java/android/media/AudioService.java +16 −1 Original line number Diff line number Diff line Loading @@ -904,6 +904,12 @@ public class AudioService extends IAudioService.Stub { /** @see AudioManager#adjustVolume(int, int) */ public void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags, String callingPackage) { adjustSuggestedStreamVolume(direction, suggestedStreamType, flags, callingPackage, Binder.getCallingUid()); } private void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags, String callingPackage, int uid) { if (DEBUG_VOL) Log.d(TAG, "adjustSuggestedStreamVolume() stream="+suggestedStreamType + ", flags=" + flags); int streamType; Loading @@ -928,7 +934,7 @@ public class AudioService extends IAudioService.Stub { if (DEBUG_VOL) Log.d(TAG, "Volume controller suppressed adjustment"); } adjustStreamVolume(streamType, direction, flags, callingPackage); adjustStreamVolume(streamType, direction, flags, callingPackage, uid); } /** @see AudioManager#adjustStreamVolume(int, int, int) */ Loading Loading @@ -5348,6 +5354,15 @@ public class AudioService extends IAudioService.Stub { * LocalServices. */ final class AudioServiceInternal extends AudioManagerInternal { @Override public void adjustSuggestedStreamVolumeForUid(int streamType, int direction, int flags, String callingPackage, int uid) { // direction and stream type swap here because the public // adjustSuggested has a different order than the other methods. adjustSuggestedStreamVolume(direction, streamType, flags, callingPackage, uid); } @Override public void adjustStreamVolumeForUid(int streamType, int direction, int flags, String callingPackage, int uid) { Loading
services/core/java/com/android/server/media/MediaSessionRecord.java +15 −4 Original line number Diff line number Diff line Loading @@ -229,8 +229,14 @@ public class MediaSessionRecord implements IBinder.DeathRecipient { * {@link AudioManager#ADJUST_SAME}. * * @param direction The direction to adjust volume in. * @param flags Any of the flags from {@link AudioManager}. * @param packageName The package that made the original volume request. * @param uid The uid that made the original volume request. * @param useSuggested True to use adjustSuggestedStreamVolume instead of * adjustStreamVolume. */ public void adjustVolume(int direction, int flags, String packageName, int uid) { public void adjustVolume(int direction, int flags, String packageName, int uid, boolean useSuggested) { if (isPlaybackActive(false) || hasFlag(MediaSession.FLAG_EXCLUSIVE_GLOBAL_PRIORITY)) { flags &= ~AudioManager.FLAG_PLAY_SOUND; } Loading @@ -241,8 +247,13 @@ public class MediaSessionRecord implements IBinder.DeathRecipient { } if (mVolumeType == PlaybackInfo.PLAYBACK_TYPE_LOCAL) { int stream = AudioAttributes.toLegacyStreamType(mAudioAttrs); mAudioManagerInternal.adjustStreamVolumeForUid(stream, direction, flags, packageName, uid); if (useSuggested) { mAudioManagerInternal.adjustSuggestedStreamVolumeForUid(stream, direction, flags, packageName, uid); } else { mAudioManagerInternal.adjustStreamVolumeForUid(stream, direction, flags, packageName, uid); } } else { if (mVolumeControlType == VolumeProvider.VOLUME_CONTROL_FIXED) { // Nothing to do, the volume cannot be changed Loading Loading @@ -1020,7 +1031,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient { int uid = Binder.getCallingUid(); final long token = Binder.clearCallingIdentity(); try { MediaSessionRecord.this.adjustVolume(direction, flags, packageName, uid); MediaSessionRecord.this.adjustVolume(direction, flags, packageName, uid, false); } finally { Binder.restoreCallingIdentity(token); } Loading
services/core/java/com/android/server/media/MediaSessionService.java +1 −1 Original line number Diff line number Diff line Loading @@ -814,7 +814,7 @@ public class MediaSessionService extends SystemService implements Monitor { } } else { session.adjustVolume(direction, flags, getContext().getPackageName(), UserHandle.myUserId()); UserHandle.myUserId(), true); if (session.getPlaybackType() == PlaybackInfo.PLAYBACK_TYPE_REMOTE && mRvc != null) { try { Loading