Loading media/java/android/media/IAudioService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ import android.view.KeyEvent; */ interface IAudioService { void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags, oneway void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags, String callingPackage, String caller); void adjustStreamVolume(int streamType, int direction, int flags, String callingPackage); Loading services/core/java/com/android/server/media/MediaSessionRecord.java +27 −7 Original line number Diff line number Diff line Loading @@ -242,19 +242,17 @@ public class MediaSessionRecord implements IBinder.DeathRecipient { } if (mVolumeType == PlaybackInfo.PLAYBACK_TYPE_LOCAL) { int stream = AudioAttributes.toLegacyStreamType(mAudioAttrs); // Adjust the volume with a handler not to be blocked by other system service. if (useSuggested) { if (AudioSystem.isStreamActive(stream, 0)) { mAudioManagerInternal.adjustSuggestedStreamVolumeForUid(stream, direction, flags, packageName, uid); postAdjustSuggestedStreamVolume(stream, direction, flags, packageName, uid); } else { flags |= previousFlagPlaySound; mAudioManagerInternal.adjustSuggestedStreamVolumeForUid( AudioManager.USE_DEFAULT_STREAM_TYPE, direction, flags, packageName, uid); postAdjustSuggestedStreamVolume(AudioManager.USE_DEFAULT_STREAM_TYPE, direction, flags, packageName, uid); } } else { mAudioManagerInternal.adjustStreamVolumeForUid(stream, direction, flags, packageName, uid); postAdjustStreamVolume(stream, direction, flags, packageName, uid); } } else { if (mVolumeControlType == VolumeProvider.VOLUME_CONTROL_FIXED) { Loading Loading @@ -461,6 +459,28 @@ public class MediaSessionRecord implements IBinder.DeathRecipient { return mPackageName + "/" + mTag; } private void postAdjustSuggestedStreamVolume(final int streamType, final int direction, final int flags, final String callingPackage, final int uid) { mHandler.post(new Runnable() { @Override public void run() { mAudioManagerInternal.adjustSuggestedStreamVolumeForUid(streamType, direction, flags, callingPackage, uid); } }); } private void postAdjustStreamVolume(final int streamType, final int direction, final int flags, final String callingPackage, final int uid) { mHandler.post(new Runnable() { @Override public void run() { mAudioManagerInternal.adjustStreamVolumeForUid(streamType, direction, flags, callingPackage, uid); } }); } private String getShortMetadataString() { int fields = mMetadata == null ? 0 : mMetadata.size(); MediaDescription description = mMetadata == null ? null : mMetadata Loading Loading
media/java/android/media/IAudioService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ import android.view.KeyEvent; */ interface IAudioService { void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags, oneway void adjustSuggestedStreamVolume(int direction, int suggestedStreamType, int flags, String callingPackage, String caller); void adjustStreamVolume(int streamType, int direction, int flags, String callingPackage); Loading
services/core/java/com/android/server/media/MediaSessionRecord.java +27 −7 Original line number Diff line number Diff line Loading @@ -242,19 +242,17 @@ public class MediaSessionRecord implements IBinder.DeathRecipient { } if (mVolumeType == PlaybackInfo.PLAYBACK_TYPE_LOCAL) { int stream = AudioAttributes.toLegacyStreamType(mAudioAttrs); // Adjust the volume with a handler not to be blocked by other system service. if (useSuggested) { if (AudioSystem.isStreamActive(stream, 0)) { mAudioManagerInternal.adjustSuggestedStreamVolumeForUid(stream, direction, flags, packageName, uid); postAdjustSuggestedStreamVolume(stream, direction, flags, packageName, uid); } else { flags |= previousFlagPlaySound; mAudioManagerInternal.adjustSuggestedStreamVolumeForUid( AudioManager.USE_DEFAULT_STREAM_TYPE, direction, flags, packageName, uid); postAdjustSuggestedStreamVolume(AudioManager.USE_DEFAULT_STREAM_TYPE, direction, flags, packageName, uid); } } else { mAudioManagerInternal.adjustStreamVolumeForUid(stream, direction, flags, packageName, uid); postAdjustStreamVolume(stream, direction, flags, packageName, uid); } } else { if (mVolumeControlType == VolumeProvider.VOLUME_CONTROL_FIXED) { Loading Loading @@ -461,6 +459,28 @@ public class MediaSessionRecord implements IBinder.DeathRecipient { return mPackageName + "/" + mTag; } private void postAdjustSuggestedStreamVolume(final int streamType, final int direction, final int flags, final String callingPackage, final int uid) { mHandler.post(new Runnable() { @Override public void run() { mAudioManagerInternal.adjustSuggestedStreamVolumeForUid(streamType, direction, flags, callingPackage, uid); } }); } private void postAdjustStreamVolume(final int streamType, final int direction, final int flags, final String callingPackage, final int uid) { mHandler.post(new Runnable() { @Override public void run() { mAudioManagerInternal.adjustStreamVolumeForUid(streamType, direction, flags, callingPackage, uid); } }); } private String getShortMetadataString() { int fields = mMetadata == null ? 0 : mMetadata.size(); MediaDescription description = mMetadata == null ? null : mMetadata Loading