Loading services/core/java/com/android/server/audio/AudioService.java +27 −10 Original line number Diff line number Diff line Loading @@ -4971,8 +4971,14 @@ public class AudioService extends IAudioService.Stub new DeviceVolumeEvent(streamType, vi.getVolumeIndex(), ada, callingPackage, currDevIsAda)); setDeviceVolumeInt(vi, vss, ada, callingPackage, FLAG_ABSOLUTE_VOLUME, /*changeMute=*/ currDevIsAda, "notifyAbsoluteVolumeChanged"); int flags = FLAG_ABSOLUTE_VOLUME; int index = rescaleVolumeInfoIndex(vi, vss); if (currDevIsAda && index != VolumeInfo.INDEX_NOT_SET && (vss.getIndex( ada.getInternalType()) + 5) / 10 != index) { flags |= AudioManager.FLAG_SHOW_UI; } setDeviceVolumeInt(vi, vss, ada, callingPackage, flags, /*changeMute=*/currDevIsAda, "notifyAbsoluteVolumeChanged"); } private static boolean isVolumeInfoValid(VolumeInfo vi, boolean forAdjust) { Loading Loading @@ -5040,6 +5046,20 @@ public class AudioService extends IAudioService.Stub + " not between min/max for stream " + vi.getStreamType()); } } else { index = rescaleVolumeInfoIndex(vi, vss); } setStreamVolumeWithAttributionInt(streamType, index, flags, ada, callingPackage, null, changeMute); } private int rescaleVolumeInfoIndex(VolumeInfo vi, VolumeStreamState vss) { int index = vi.getVolumeIndex(); if (vi.getMinVolumeIndex() == VolumeInfo.INDEX_NOT_SET || vi.getMaxVolumeIndex() == VolumeInfo.INDEX_NOT_SET) { // no rescaling if the min max are not set return index; } // check if index needs to be rescaled final int min = (vss.getMinIndex() + 5) / 10; final int max = (vss.getMaxIndex() + 5) / 10; Loading @@ -5048,10 +5068,7 @@ public class AudioService extends IAudioService.Stub /*srcMin*/ vi.getMinVolumeIndex(), /*srcMax*/ vi.getMaxVolumeIndex(), /*dstMin*/ min, /*dstMax*/ max); } } setStreamVolumeWithAttributionInt(streamType, index, flags, ada, callingPackage, null, changeMute); return index; } /** Retain API for unsupported app usage */ Loading Loading
services/core/java/com/android/server/audio/AudioService.java +27 −10 Original line number Diff line number Diff line Loading @@ -4971,8 +4971,14 @@ public class AudioService extends IAudioService.Stub new DeviceVolumeEvent(streamType, vi.getVolumeIndex(), ada, callingPackage, currDevIsAda)); setDeviceVolumeInt(vi, vss, ada, callingPackage, FLAG_ABSOLUTE_VOLUME, /*changeMute=*/ currDevIsAda, "notifyAbsoluteVolumeChanged"); int flags = FLAG_ABSOLUTE_VOLUME; int index = rescaleVolumeInfoIndex(vi, vss); if (currDevIsAda && index != VolumeInfo.INDEX_NOT_SET && (vss.getIndex( ada.getInternalType()) + 5) / 10 != index) { flags |= AudioManager.FLAG_SHOW_UI; } setDeviceVolumeInt(vi, vss, ada, callingPackage, flags, /*changeMute=*/currDevIsAda, "notifyAbsoluteVolumeChanged"); } private static boolean isVolumeInfoValid(VolumeInfo vi, boolean forAdjust) { Loading Loading @@ -5040,6 +5046,20 @@ public class AudioService extends IAudioService.Stub + " not between min/max for stream " + vi.getStreamType()); } } else { index = rescaleVolumeInfoIndex(vi, vss); } setStreamVolumeWithAttributionInt(streamType, index, flags, ada, callingPackage, null, changeMute); } private int rescaleVolumeInfoIndex(VolumeInfo vi, VolumeStreamState vss) { int index = vi.getVolumeIndex(); if (vi.getMinVolumeIndex() == VolumeInfo.INDEX_NOT_SET || vi.getMaxVolumeIndex() == VolumeInfo.INDEX_NOT_SET) { // no rescaling if the min max are not set return index; } // check if index needs to be rescaled final int min = (vss.getMinIndex() + 5) / 10; final int max = (vss.getMaxIndex() + 5) / 10; Loading @@ -5048,10 +5068,7 @@ public class AudioService extends IAudioService.Stub /*srcMin*/ vi.getMinVolumeIndex(), /*srcMax*/ vi.getMaxVolumeIndex(), /*dstMin*/ min, /*dstMax*/ max); } } setStreamVolumeWithAttributionInt(streamType, index, flags, ada, callingPackage, null, changeMute); return index; } /** Retain API for unsupported app usage */ Loading