Merge "MediaSession: Do not lock on AudioManager.getStreamVolume" into mnc-dev
This commit is contained in:
@@ -1067,23 +1067,22 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ParcelableVolumeInfo getVolumeAttributes() {
|
public ParcelableVolumeInfo getVolumeAttributes() {
|
||||||
|
int volumeType;
|
||||||
|
AudioAttributes attributes;
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
int type;
|
|
||||||
int max;
|
|
||||||
int current;
|
|
||||||
if (mVolumeType == PlaybackInfo.PLAYBACK_TYPE_REMOTE) {
|
if (mVolumeType == PlaybackInfo.PLAYBACK_TYPE_REMOTE) {
|
||||||
type = mVolumeControlType;
|
int current = mOptimisticVolume != -1 ? mOptimisticVolume : mCurrentVolume;
|
||||||
max = mMaxVolume;
|
return new ParcelableVolumeInfo(
|
||||||
current = mOptimisticVolume != -1 ? mOptimisticVolume
|
mVolumeType, mAudioAttrs, mVolumeControlType, mMaxVolume, current);
|
||||||
: mCurrentVolume;
|
|
||||||
} else {
|
|
||||||
int stream = AudioAttributes.toLegacyStreamType(mAudioAttrs);
|
|
||||||
type = VolumeProvider.VOLUME_CONTROL_ABSOLUTE;
|
|
||||||
max = mAudioManager.getStreamMaxVolume(stream);
|
|
||||||
current = mAudioManager.getStreamVolume(stream);
|
|
||||||
}
|
}
|
||||||
return new ParcelableVolumeInfo(mVolumeType, mAudioAttrs, type, max, current);
|
volumeType = mVolumeType;
|
||||||
|
attributes = mAudioAttrs;
|
||||||
}
|
}
|
||||||
|
int stream = AudioAttributes.toLegacyStreamType(attributes);
|
||||||
|
int max = mAudioManager.getStreamMaxVolume(stream);
|
||||||
|
int current = mAudioManager.getStreamVolume(stream);
|
||||||
|
return new ParcelableVolumeInfo(
|
||||||
|
volumeType, attributes, VolumeProvider.VOLUME_CONTROL_ABSOLUTE, max, current);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user