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