DO NOT MERGE AudioService: setDeviceVolume no-op when for current device am: 566b5183be
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21337828 Change-Id: Ie55752952c18a3f18b58813223400b2d2c1170fd Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -3834,8 +3834,15 @@ public class AudioService extends IAudioService.Stub
|
|||||||
// VOLUME_CHANGED_ACTION intent to see if the current device is the one being modified
|
// VOLUME_CHANGED_ACTION intent to see if the current device is the one being modified
|
||||||
final int currDev = getDeviceForStream(vi.getStreamType());
|
final int currDev = getDeviceForStream(vi.getStreamType());
|
||||||
|
|
||||||
|
final boolean skipping = (currDev == ada.getInternalType());
|
||||||
|
|
||||||
AudioService.sVolumeLogger.log(new DeviceVolumeEvent(vi.getStreamType(), index, ada,
|
AudioService.sVolumeLogger.log(new DeviceVolumeEvent(vi.getStreamType(), index, ada,
|
||||||
currDev, callingPackage));
|
currDev, callingPackage, skipping));
|
||||||
|
|
||||||
|
if (skipping) {
|
||||||
|
// setDeviceVolume was called on a device currently being used
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO handle unmuting of current audio device
|
// TODO handle unmuting of current audio device
|
||||||
// if a stream is not muted but the VolumeInfo is for muting, set the volume index
|
// if a stream is not muted but the VolumeInfo is for muting, set the volume index
|
||||||
|
|||||||
@@ -174,15 +174,17 @@ public class AudioServiceEvents {
|
|||||||
final String mDeviceAddress;
|
final String mDeviceAddress;
|
||||||
final String mCaller;
|
final String mCaller;
|
||||||
final int mDeviceForStream;
|
final int mDeviceForStream;
|
||||||
|
final boolean mSkipped;
|
||||||
|
|
||||||
DeviceVolumeEvent(int streamType, int index, @NonNull AudioDeviceAttributes device,
|
DeviceVolumeEvent(int streamType, int index, @NonNull AudioDeviceAttributes device,
|
||||||
int deviceForStream, String callingPackage) {
|
int deviceForStream, String callingPackage, boolean skipped) {
|
||||||
mStream = streamType;
|
mStream = streamType;
|
||||||
mVolIndex = index;
|
mVolIndex = index;
|
||||||
mDeviceNativeType = "0x" + Integer.toHexString(device.getInternalType());
|
mDeviceNativeType = "0x" + Integer.toHexString(device.getInternalType());
|
||||||
mDeviceAddress = device.getAddress();
|
mDeviceAddress = device.getAddress();
|
||||||
mDeviceForStream = deviceForStream;
|
mDeviceForStream = deviceForStream;
|
||||||
mCaller = callingPackage;
|
mCaller = callingPackage;
|
||||||
|
mSkipped = skipped;
|
||||||
// log metrics
|
// log metrics
|
||||||
new MediaMetrics.Item(MediaMetrics.Name.AUDIO_VOLUME_EVENT)
|
new MediaMetrics.Item(MediaMetrics.Name.AUDIO_VOLUME_EVENT)
|
||||||
.set(MediaMetrics.Property.EVENT, "setDeviceVolume")
|
.set(MediaMetrics.Property.EVENT, "setDeviceVolume")
|
||||||
@@ -197,14 +199,18 @@ public class AudioServiceEvents {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String eventToString() {
|
public String eventToString() {
|
||||||
return new StringBuilder("setDeviceVolume(stream:")
|
final StringBuilder sb = new StringBuilder("setDeviceVolume(stream:")
|
||||||
.append(AudioSystem.streamToString(mStream))
|
.append(AudioSystem.streamToString(mStream))
|
||||||
.append(" index:").append(mVolIndex)
|
.append(" index:").append(mVolIndex)
|
||||||
.append(" device:").append(mDeviceNativeType)
|
.append(" device:").append(mDeviceNativeType)
|
||||||
.append(" addr:").append(mDeviceAddress)
|
.append(" addr:").append(mDeviceAddress)
|
||||||
.append(") from ").append(mCaller)
|
.append(") from ").append(mCaller);
|
||||||
.append(" currDevForStream:Ox").append(Integer.toHexString(mDeviceForStream))
|
if (mSkipped) {
|
||||||
.toString();
|
sb.append(" skipped [device in use]");
|
||||||
|
} else {
|
||||||
|
sb.append(" currDevForStream:Ox").append(Integer.toHexString(mDeviceForStream));
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user