Loading services/core/java/com/android/server/audio/AudioService.java +66 −60 Original line number Diff line number Diff line Loading @@ -9718,8 +9718,6 @@ public class AudioService extends IAudioService.Stub } } } } } if (changed) { // If associated to volume group, update group cache updateVolumeGroupIndex(device, /* forceMuteState= */ false); Loading @@ -9727,24 +9725,27 @@ public class AudioService extends IAudioService.Stub oldIndex = (oldIndex + 5) / 10; index = (index + 5) / 10; // log base stream changes to the event log if (sStreamVolumeAlias.get(mStreamType, /*valueIfKeyNotFound=*/-1) == mStreamType) { if (sStreamVolumeAlias.get(mStreamType, /*valueIfKeyNotFound=*/-1) == mStreamType) { if (caller == null) { Log.w(TAG, "No caller for volume_changed event", new Throwable()); } EventLogTags.writeVolumeChanged(mStreamType, oldIndex, index, mIndexMax / 10, caller); EventLogTags.writeVolumeChanged( mStreamType, oldIndex, index, mIndexMax / 10, caller); } // fire changed intents for all streams, but only when the device it changed on // fire changed intents for all streams, but only when the device it changed // on // is the current device if ((index != oldIndex) && isCurrentDevice) { // for single volume devices, only send the volume change broadcast // on the alias stream final int streamAlias = sStreamVolumeAlias.get( mStreamType, /*valueIfKeyNotFound=*/-1); final int streamAlias = sStreamVolumeAlias.get(mStreamType, /*valueIfKeyNotFound=*/-1); if (!mIsSingleVolume || streamAlias == mStreamType) { mVolumeChanged.putExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE, index); mVolumeChanged.putExtra(AudioManager.EXTRA_PREV_VOLUME_STREAM_VALUE, oldIndex); mVolumeChanged.putExtra( AudioManager.EXTRA_VOLUME_STREAM_VALUE, index); mVolumeChanged.putExtra( AudioManager.EXTRA_PREV_VOLUME_STREAM_VALUE, oldIndex); int extraStreamType = mStreamType; // TODO: remove this when deprecating STREAM_BLUETOOTH_SCO if (isStreamBluetoothSco(mStreamType)) { Loading @@ -9752,11 +9753,11 @@ public class AudioService extends IAudioService.Stub AudioSystem.STREAM_BLUETOOTH_SCO); extraStreamType = AudioSystem.STREAM_BLUETOOTH_SCO; } else { mVolumeChanged.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, mStreamType); mVolumeChanged.putExtra( AudioManager.EXTRA_VOLUME_STREAM_TYPE, mStreamType); } mVolumeChanged.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE_ALIAS, streamAlias); mVolumeChanged.putExtra( AudioManager.EXTRA_VOLUME_STREAM_TYPE_ALIAS, streamAlias); if (mStreamType == streamAlias) { String aliasStreamIndexesString = ""; Loading @@ -9764,18 +9765,21 @@ public class AudioService extends IAudioService.Stub aliasStreamIndexesString = " aliased streams: " + aliasStreamIndexes; } AudioService.sVolumeLogger.enqueue(new VolChangedBroadcastEvent( extraStreamType, aliasStreamIndexesString, index, oldIndex)); AudioService.sVolumeLogger.enqueue( new VolChangedBroadcastEvent(extraStreamType, aliasStreamIndexesString, index, oldIndex)); if (extraStreamType != mStreamType) { AudioService.sVolumeLogger.enqueue(new VolChangedBroadcastEvent( mStreamType, aliasStreamIndexesString, index, oldIndex)); AudioService.sVolumeLogger.enqueue( new VolChangedBroadcastEvent(mStreamType, aliasStreamIndexesString, index, oldIndex)); } } sendBroadcastToAll(mVolumeChanged, mVolumeChangedOptions); if (extraStreamType != mStreamType) { // send multiple intents in case we merged voice call and bt sco streams mVolumeChanged.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, mStreamType); // send multiple intents in case we merged voice call and bt sco // streams mVolumeChanged.putExtra( AudioManager.EXTRA_VOLUME_STREAM_TYPE, mStreamType); // do not use the options in thid case which could discard // the previous intent sendBroadcastToAll(mVolumeChanged, null); Loading @@ -9785,6 +9789,8 @@ public class AudioService extends IAudioService.Stub } return changed; } } } public int getIndex(int device) { synchronized (mVolumeStateLock) { Loading Loading
services/core/java/com/android/server/audio/AudioService.java +66 −60 Original line number Diff line number Diff line Loading @@ -9718,8 +9718,6 @@ public class AudioService extends IAudioService.Stub } } } } } if (changed) { // If associated to volume group, update group cache updateVolumeGroupIndex(device, /* forceMuteState= */ false); Loading @@ -9727,24 +9725,27 @@ public class AudioService extends IAudioService.Stub oldIndex = (oldIndex + 5) / 10; index = (index + 5) / 10; // log base stream changes to the event log if (sStreamVolumeAlias.get(mStreamType, /*valueIfKeyNotFound=*/-1) == mStreamType) { if (sStreamVolumeAlias.get(mStreamType, /*valueIfKeyNotFound=*/-1) == mStreamType) { if (caller == null) { Log.w(TAG, "No caller for volume_changed event", new Throwable()); } EventLogTags.writeVolumeChanged(mStreamType, oldIndex, index, mIndexMax / 10, caller); EventLogTags.writeVolumeChanged( mStreamType, oldIndex, index, mIndexMax / 10, caller); } // fire changed intents for all streams, but only when the device it changed on // fire changed intents for all streams, but only when the device it changed // on // is the current device if ((index != oldIndex) && isCurrentDevice) { // for single volume devices, only send the volume change broadcast // on the alias stream final int streamAlias = sStreamVolumeAlias.get( mStreamType, /*valueIfKeyNotFound=*/-1); final int streamAlias = sStreamVolumeAlias.get(mStreamType, /*valueIfKeyNotFound=*/-1); if (!mIsSingleVolume || streamAlias == mStreamType) { mVolumeChanged.putExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE, index); mVolumeChanged.putExtra(AudioManager.EXTRA_PREV_VOLUME_STREAM_VALUE, oldIndex); mVolumeChanged.putExtra( AudioManager.EXTRA_VOLUME_STREAM_VALUE, index); mVolumeChanged.putExtra( AudioManager.EXTRA_PREV_VOLUME_STREAM_VALUE, oldIndex); int extraStreamType = mStreamType; // TODO: remove this when deprecating STREAM_BLUETOOTH_SCO if (isStreamBluetoothSco(mStreamType)) { Loading @@ -9752,11 +9753,11 @@ public class AudioService extends IAudioService.Stub AudioSystem.STREAM_BLUETOOTH_SCO); extraStreamType = AudioSystem.STREAM_BLUETOOTH_SCO; } else { mVolumeChanged.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, mStreamType); mVolumeChanged.putExtra( AudioManager.EXTRA_VOLUME_STREAM_TYPE, mStreamType); } mVolumeChanged.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE_ALIAS, streamAlias); mVolumeChanged.putExtra( AudioManager.EXTRA_VOLUME_STREAM_TYPE_ALIAS, streamAlias); if (mStreamType == streamAlias) { String aliasStreamIndexesString = ""; Loading @@ -9764,18 +9765,21 @@ public class AudioService extends IAudioService.Stub aliasStreamIndexesString = " aliased streams: " + aliasStreamIndexes; } AudioService.sVolumeLogger.enqueue(new VolChangedBroadcastEvent( extraStreamType, aliasStreamIndexesString, index, oldIndex)); AudioService.sVolumeLogger.enqueue( new VolChangedBroadcastEvent(extraStreamType, aliasStreamIndexesString, index, oldIndex)); if (extraStreamType != mStreamType) { AudioService.sVolumeLogger.enqueue(new VolChangedBroadcastEvent( mStreamType, aliasStreamIndexesString, index, oldIndex)); AudioService.sVolumeLogger.enqueue( new VolChangedBroadcastEvent(mStreamType, aliasStreamIndexesString, index, oldIndex)); } } sendBroadcastToAll(mVolumeChanged, mVolumeChangedOptions); if (extraStreamType != mStreamType) { // send multiple intents in case we merged voice call and bt sco streams mVolumeChanged.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, mStreamType); // send multiple intents in case we merged voice call and bt sco // streams mVolumeChanged.putExtra( AudioManager.EXTRA_VOLUME_STREAM_TYPE, mStreamType); // do not use the options in thid case which could discard // the previous intent sendBroadcastToAll(mVolumeChanged, null); Loading @@ -9785,6 +9789,8 @@ public class AudioService extends IAudioService.Stub } return changed; } } } public int getIndex(int device) { synchronized (mVolumeStateLock) { Loading