* commit '13d1057d5b3ca46d00d627a89f0d37836b9db8fd': Don't unmute when trying to show volume UI. DO NOT MERGE
This commit is contained in:
@ -93,7 +93,6 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
private final MediaSessionService mService;
|
||||
private final boolean mUseMasterVolume;
|
||||
|
||||
private final IBinder mICallback = new Binder();
|
||||
private final Object mLock = new Object();
|
||||
private final ArrayList<ISessionControllerCallback> mControllerCallbacks =
|
||||
new ArrayList<ISessionControllerCallback>();
|
||||
@ -260,13 +259,13 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
boolean isMasterMute = mAudioManager.isMasterMute();
|
||||
if (isMute) {
|
||||
mAudioManagerInternal.setMasterMuteForUid(!isMasterMute,
|
||||
flags, packageName, mICallback, uid);
|
||||
flags, packageName, mService.mICallback, uid);
|
||||
} else {
|
||||
mAudioManagerInternal.adjustMasterVolumeForUid(direction, flags, packageName,
|
||||
uid);
|
||||
if (isMasterMute) {
|
||||
mAudioManagerInternal.setMasterMuteForUid(false,
|
||||
flags, packageName, mICallback, uid);
|
||||
flags, packageName, mService.mICallback, uid);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -280,7 +279,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
} else {
|
||||
mAudioManagerInternal.adjustSuggestedStreamVolumeForUid(stream, direction,
|
||||
flags, packageName, uid);
|
||||
if (isStreamMute) {
|
||||
if (isStreamMute && direction != 0) {
|
||||
mAudioManager.setStreamMute(stream, false);
|
||||
}
|
||||
}
|
||||
@ -295,7 +294,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
mAudioManagerInternal.adjustSuggestedStreamVolumeForUid(
|
||||
AudioManager.USE_DEFAULT_STREAM_TYPE, direction, flags, packageName,
|
||||
uid);
|
||||
if (isStreamMute) {
|
||||
if (isStreamMute && direction != 0) {
|
||||
mAudioManager.setStreamMute(AudioManager.USE_DEFAULT_STREAM_TYPE,
|
||||
false);
|
||||
}
|
||||
@ -307,7 +306,7 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
|
||||
} else {
|
||||
mAudioManagerInternal.adjustStreamVolumeForUid(stream, direction, flags,
|
||||
packageName, uid);
|
||||
if (isStreamMute) {
|
||||
if (isStreamMute && direction != 0) {
|
||||
mAudioManager.setStreamMute(stream, false);
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +77,8 @@ public class MediaSessionService extends SystemService implements Monitor {
|
||||
|
||||
private static final int WAKELOCK_TIMEOUT = 5000;
|
||||
|
||||
/* package */final IBinder mICallback = new Binder();
|
||||
|
||||
private final SessionManagerImpl mSessionManagerImpl;
|
||||
private final MediaSessionStack mPriorityStack;
|
||||
|
||||
@ -91,6 +93,7 @@ public class MediaSessionService extends SystemService implements Monitor {
|
||||
|
||||
private KeyguardManager mKeyguardManager;
|
||||
private IAudioService mAudioService;
|
||||
private AudioManager mAudioManager;
|
||||
private ContentResolver mContentResolver;
|
||||
private SettingsObserver mSettingsObserver;
|
||||
|
||||
@ -118,6 +121,7 @@ public class MediaSessionService extends SystemService implements Monitor {
|
||||
mKeyguardManager =
|
||||
(KeyguardManager) getContext().getSystemService(Context.KEYGUARD_SERVICE);
|
||||
mAudioService = getAudioService();
|
||||
mAudioManager = (AudioManager) getContext().getSystemService(Context.AUDIO_SERVICE);
|
||||
mContentResolver = getContext().getContentResolver();
|
||||
mSettingsObserver = new SettingsObserver();
|
||||
mSettingsObserver.observe();
|
||||
@ -589,8 +593,6 @@ public class MediaSessionService extends SystemService implements Monitor {
|
||||
"android.media.AudioService.WAKELOCK_ACQUIRED";
|
||||
private static final int WAKELOCK_RELEASE_ON_FINISHED = 1980; // magic number
|
||||
|
||||
private final IBinder mICallback = new Binder();
|
||||
|
||||
private boolean mVoiceButtonDown = false;
|
||||
private boolean mVoiceButtonHandled = false;
|
||||
|
||||
@ -845,14 +847,14 @@ public class MediaSessionService extends SystemService implements Monitor {
|
||||
} else {
|
||||
boolean isStreamMute = mAudioService.isStreamMute(suggestedStream);
|
||||
if (direction == MediaSessionManager.DIRECTION_MUTE) {
|
||||
mAudioService.setStreamMute(suggestedStream, !isStreamMute, mICallback);
|
||||
mAudioManager.setStreamMute(suggestedStream, !isStreamMute);
|
||||
} else {
|
||||
mAudioService.adjustSuggestedStreamVolume(direction, suggestedStream,
|
||||
flags, packageName);
|
||||
// Do not call setStreamMute when direction = 0 which is used just to
|
||||
// show the UI.
|
||||
if (isStreamMute && direction != 0) {
|
||||
mAudioService.setStreamMute(suggestedStream, false, mICallback);
|
||||
mAudioManager.setStreamMute(suggestedStream, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user