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