Loading services/core/java/com/android/server/audio/AudioService.java +9 −1 Original line number Diff line number Diff line Loading @@ -5274,6 +5274,7 @@ public class AudioService extends IAudioService.Stub switch (mode) { case AudioSystem.MODE_IN_COMMUNICATION: case AudioSystem.MODE_IN_CALL: case AudioSystem.MODE_RINGTONE: // TODO(b/382704431): remove to allow STREAM_VOICE_CALL to drive abs volume // over A2DP if (getDeviceForStream(AudioSystem.STREAM_VOICE_CALL) Loading Loading @@ -5588,10 +5589,12 @@ public class AudioService extends IAudioService.Stub AudioSystem.DEVICE_OUT_ALL_A2DP_SET); absVolumeDeviceTypes.addAll(mAbsVolumeMultiModeCaseDevices); absVolumeDeviceTypes.add(AudioSystem.DEVICE_OUT_BLE_BROADCAST); absVolumeDeviceTypes.addAll(AudioSystem.DEVICE_OUT_ALL_SCO_SET); final Set<AudioDeviceAttributes> absVolumeDevices = AudioSystem.intersectionAudioDeviceTypes(absVolumeDeviceTypes, devices); if (absVolumeDevices.isEmpty()) { Slog.v(TAG, "No absolute volume devices"); return; } if (absVolumeDevices.size() > 1) { Loading Loading @@ -5745,8 +5748,13 @@ public class AudioService extends IAudioService.Stub if (unifyAbsoluteVolumeManagement()) { volInfoBuilder.setMuted(muted); } final VolumeInfo dispatchVolumeInfo = volInfoBuilder.build(); sVolumeLogger.enqueue(new VolumeEvent(VolumeEvent.VOL_SET_ABS_VOL, dispatchVolumeInfo.getStreamType(), dispatchVolumeInfo.getVolumeIndex(), deviceInfo.mDevice.getInternalType(), muted)); deviceInfo.mCallback.dispatchDeviceVolumeChanged(deviceInfo.mDevice, volInfoBuilder.build()); dispatchVolumeInfo); } catch (RemoteException e) { Log.w(TAG, "Couldn't dispatch absolute volume behavior volume change"); } Loading services/core/java/com/android/server/audio/AudioServiceEvents.java +31 −0 Original line number Diff line number Diff line Loading @@ -278,6 +278,7 @@ public class AudioServiceEvents { static final int VOL_ADJUST_GROUP_VOL = 11; static final int VOL_MASTER_MUTE = 12; static final int VOL_ABS_DEVICE_ENABLED_ERROR = 13; static final int VOL_SET_ABS_VOL = 14; final int mOp; final int mStream; Loading Loading @@ -343,6 +344,19 @@ public class AudioServiceEvents { logMetricEvent(); } /** used for VOL_SET_ABS_VOL */ VolumeEvent(int op, int stream, int index, int device, boolean muted) { mOp = op; mVal1 = index; // unused mVal2 = device; mVal3 = muted ? 1 : 0; mStream = stream; mCaller = null; mGroupName = null; logMetricEvent(); } /** used for VOL_VOICE_ACTIVITY_CONTEXTUAL_VOLUME */ VolumeEvent(int op, boolean voiceActive, int stream, int index, int device) { mOp = op; Loading Loading @@ -502,6 +516,16 @@ public class AudioServiceEvents { .set(MediaMetrics.Property.INDEX, mVal1) .record(); return; case VOL_SET_ABS_VOL: new MediaMetrics.Item(mMetricsId) .set(MediaMetrics.Property.EVENT, "setAbsoluteVolume") .set(MediaMetrics.Property.STREAM_TYPE, AudioSystem.streamToString(mStream)) .set(MediaMetrics.Property.INDEX, mVal3 == 1 ? 0 : mVal1) .set(MediaMetrics.Property.DEVICE, AudioSystem.getOutputDeviceName(mVal2)) .record(); return; case VOL_VOICE_ACTIVITY_CONTEXTUAL_VOLUME: new MediaMetrics.Item(mMetricsId) .set(MediaMetrics.Property.EVENT, "voiceActivityContextualVolume") Loading Loading @@ -593,6 +617,13 @@ public class AudioServiceEvents { return new StringBuilder("setAvrcpVolume:") .append(" index:").append(mVal1) .toString(); case VOL_SET_ABS_VOL: return new StringBuilder("setAbsoluteVolume:") .append(" stream:").append(AudioSystem.streamToString(mStream)) .append(" index:").append(mVal1) .append(" muted:").append(mVal3 == 1 ? "true" : "false") .append(" device:").append(AudioSystem.getOutputDeviceName(mVal2)) .toString(); case VOL_ADJUST_VOL_UID: return new StringBuilder("adjustStreamVolumeForUid(stream:") .append(AudioSystem.streamToString(mStream)) Loading Loading
services/core/java/com/android/server/audio/AudioService.java +9 −1 Original line number Diff line number Diff line Loading @@ -5274,6 +5274,7 @@ public class AudioService extends IAudioService.Stub switch (mode) { case AudioSystem.MODE_IN_COMMUNICATION: case AudioSystem.MODE_IN_CALL: case AudioSystem.MODE_RINGTONE: // TODO(b/382704431): remove to allow STREAM_VOICE_CALL to drive abs volume // over A2DP if (getDeviceForStream(AudioSystem.STREAM_VOICE_CALL) Loading Loading @@ -5588,10 +5589,12 @@ public class AudioService extends IAudioService.Stub AudioSystem.DEVICE_OUT_ALL_A2DP_SET); absVolumeDeviceTypes.addAll(mAbsVolumeMultiModeCaseDevices); absVolumeDeviceTypes.add(AudioSystem.DEVICE_OUT_BLE_BROADCAST); absVolumeDeviceTypes.addAll(AudioSystem.DEVICE_OUT_ALL_SCO_SET); final Set<AudioDeviceAttributes> absVolumeDevices = AudioSystem.intersectionAudioDeviceTypes(absVolumeDeviceTypes, devices); if (absVolumeDevices.isEmpty()) { Slog.v(TAG, "No absolute volume devices"); return; } if (absVolumeDevices.size() > 1) { Loading Loading @@ -5745,8 +5748,13 @@ public class AudioService extends IAudioService.Stub if (unifyAbsoluteVolumeManagement()) { volInfoBuilder.setMuted(muted); } final VolumeInfo dispatchVolumeInfo = volInfoBuilder.build(); sVolumeLogger.enqueue(new VolumeEvent(VolumeEvent.VOL_SET_ABS_VOL, dispatchVolumeInfo.getStreamType(), dispatchVolumeInfo.getVolumeIndex(), deviceInfo.mDevice.getInternalType(), muted)); deviceInfo.mCallback.dispatchDeviceVolumeChanged(deviceInfo.mDevice, volInfoBuilder.build()); dispatchVolumeInfo); } catch (RemoteException e) { Log.w(TAG, "Couldn't dispatch absolute volume behavior volume change"); } Loading
services/core/java/com/android/server/audio/AudioServiceEvents.java +31 −0 Original line number Diff line number Diff line Loading @@ -278,6 +278,7 @@ public class AudioServiceEvents { static final int VOL_ADJUST_GROUP_VOL = 11; static final int VOL_MASTER_MUTE = 12; static final int VOL_ABS_DEVICE_ENABLED_ERROR = 13; static final int VOL_SET_ABS_VOL = 14; final int mOp; final int mStream; Loading Loading @@ -343,6 +344,19 @@ public class AudioServiceEvents { logMetricEvent(); } /** used for VOL_SET_ABS_VOL */ VolumeEvent(int op, int stream, int index, int device, boolean muted) { mOp = op; mVal1 = index; // unused mVal2 = device; mVal3 = muted ? 1 : 0; mStream = stream; mCaller = null; mGroupName = null; logMetricEvent(); } /** used for VOL_VOICE_ACTIVITY_CONTEXTUAL_VOLUME */ VolumeEvent(int op, boolean voiceActive, int stream, int index, int device) { mOp = op; Loading Loading @@ -502,6 +516,16 @@ public class AudioServiceEvents { .set(MediaMetrics.Property.INDEX, mVal1) .record(); return; case VOL_SET_ABS_VOL: new MediaMetrics.Item(mMetricsId) .set(MediaMetrics.Property.EVENT, "setAbsoluteVolume") .set(MediaMetrics.Property.STREAM_TYPE, AudioSystem.streamToString(mStream)) .set(MediaMetrics.Property.INDEX, mVal3 == 1 ? 0 : mVal1) .set(MediaMetrics.Property.DEVICE, AudioSystem.getOutputDeviceName(mVal2)) .record(); return; case VOL_VOICE_ACTIVITY_CONTEXTUAL_VOLUME: new MediaMetrics.Item(mMetricsId) .set(MediaMetrics.Property.EVENT, "voiceActivityContextualVolume") Loading Loading @@ -593,6 +617,13 @@ public class AudioServiceEvents { return new StringBuilder("setAvrcpVolume:") .append(" index:").append(mVal1) .toString(); case VOL_SET_ABS_VOL: return new StringBuilder("setAbsoluteVolume:") .append(" stream:").append(AudioSystem.streamToString(mStream)) .append(" index:").append(mVal1) .append(" muted:").append(mVal3 == 1 ? "true" : "false") .append(" device:").append(AudioSystem.getOutputDeviceName(mVal2)) .toString(); case VOL_ADJUST_VOL_UID: return new StringBuilder("adjustStreamVolumeForUid(stream:") .append(AudioSystem.streamToString(mStream)) Loading