* commit 'd3b463171ff74b04f214dae822babb1d4a6d286d': audio service: fix system volume settings
This commit is contained in:
@@ -1737,7 +1737,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
|||||||
streamState.readSettings();
|
streamState.readSettings();
|
||||||
|
|
||||||
// unmute stream that was muted but is not affect by mute anymore
|
// unmute stream that was muted but is not affect by mute anymore
|
||||||
if (streamState.muteCount() != 0 && !isStreamAffectedByMute(streamType)) {
|
if (streamState.muteCount() != 0 && !isStreamAffectedByMute(streamType) &&
|
||||||
|
!isStreamMutedByRingerMode(streamType)) {
|
||||||
int size = streamState.mDeathHandlers.size();
|
int size = streamState.mDeathHandlers.size();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
streamState.mDeathHandlers.get(i).mMuteCount = 1;
|
streamState.mDeathHandlers.get(i).mMuteCount = 1;
|
||||||
@@ -2591,6 +2592,18 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
|||||||
public synchronized void readSettings() {
|
public synchronized void readSettings() {
|
||||||
int remainingDevices = AudioSystem.DEVICE_OUT_ALL;
|
int remainingDevices = AudioSystem.DEVICE_OUT_ALL;
|
||||||
|
|
||||||
|
// do not read system stream volume from settings: this stream is always aliased
|
||||||
|
// to another stream type and its volume is never persisted. Values in settings can
|
||||||
|
// only be stale values
|
||||||
|
if ((mStreamType == AudioSystem.STREAM_SYSTEM) ||
|
||||||
|
(mStreamType == AudioSystem.STREAM_SYSTEM_ENFORCED)) {
|
||||||
|
mLastAudibleIndex.put(AudioSystem.DEVICE_OUT_DEFAULT,
|
||||||
|
10 * AudioManager.DEFAULT_STREAM_VOLUME[mStreamType]);
|
||||||
|
mIndex.put(AudioSystem.DEVICE_OUT_DEFAULT,
|
||||||
|
10 * AudioManager.DEFAULT_STREAM_VOLUME[mStreamType]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; remainingDevices != 0; i++) {
|
for (int i = 0; remainingDevices != 0; i++) {
|
||||||
int device = (1 << i);
|
int device = (1 << i);
|
||||||
if ((device & remainingDevices) == 0) {
|
if ((device & remainingDevices) == 0) {
|
||||||
@@ -2621,11 +2634,8 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
|||||||
|
|
||||||
// a last audible index of 0 should never be stored for ring and notification
|
// a last audible index of 0 should never be stored for ring and notification
|
||||||
// streams on phones (voice capable devices).
|
// streams on phones (voice capable devices).
|
||||||
// same for system stream on phones and tablets
|
if ((lastAudibleIndex == 0) && mVoiceCapable &&
|
||||||
if ((lastAudibleIndex == 0) &&
|
(mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_RING)) {
|
||||||
((mVoiceCapable &&
|
|
||||||
(mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_RING)) ||
|
|
||||||
(mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_SYSTEM))) {
|
|
||||||
lastAudibleIndex = AudioManager.DEFAULT_STREAM_VOLUME[mStreamType];
|
lastAudibleIndex = AudioManager.DEFAULT_STREAM_VOLUME[mStreamType];
|
||||||
// Correct the data base
|
// Correct the data base
|
||||||
sendMsg(mAudioHandler,
|
sendMsg(mAudioHandler,
|
||||||
@@ -2639,11 +2649,9 @@ public class AudioService extends IAudioService.Stub implements OnFinished {
|
|||||||
mLastAudibleIndex.put(device, getValidIndex(10 * lastAudibleIndex));
|
mLastAudibleIndex.put(device, getValidIndex(10 * lastAudibleIndex));
|
||||||
// the initial index should never be 0 for ring and notification streams on phones
|
// the initial index should never be 0 for ring and notification streams on phones
|
||||||
// (voice capable devices) if not in silent or vibrate mode.
|
// (voice capable devices) if not in silent or vibrate mode.
|
||||||
// same for system stream on phones and tablets
|
|
||||||
if ((index == 0) && (mRingerMode == AudioManager.RINGER_MODE_NORMAL) &&
|
if ((index == 0) && (mRingerMode == AudioManager.RINGER_MODE_NORMAL) &&
|
||||||
((mVoiceCapable &&
|
mVoiceCapable &&
|
||||||
(mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_RING)) ||
|
(mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_RING)) {
|
||||||
(mStreamVolumeAlias[mStreamType] == AudioSystem.STREAM_SYSTEM))) {
|
|
||||||
index = lastAudibleIndex;
|
index = lastAudibleIndex;
|
||||||
// Correct the data base
|
// Correct the data base
|
||||||
sendMsg(mAudioHandler,
|
sendMsg(mAudioHandler,
|
||||||
|
|||||||
Reference in New Issue
Block a user