Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16aa857f authored by Vlad Popa's avatar Vlad Popa
Browse files

Fix order of mute adjustment in VGS sync with VSS

If setting the index before the mute this can lead to reapplying a stale
mute value that was not updated on the initial stream state

Test: adb shell device_config put media_audio com.android.media.audio.vgs_vss_sync_mute_order true
Test: https://android-build.corp.google.com/test_investigate/?invocationId=I82200010260265841&testResultId=TR11329232125910570
Bug: 331849188
Change-Id: If8940f123c9a94860fb3b154bcfd123fdebf0ba0
parent 0d8256dd
Loading
Loading
Loading
Loading
+16 −3
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import static com.android.media.audio.Flags.alarmMinVolumeZero;
import static com.android.media.audio.Flags.disablePrescaleAbsoluteVolume;
import static com.android.media.audio.Flags.ringerModeAffectsAlarm;
import static com.android.media.audio.Flags.setStreamVolumeOrder;
import static com.android.media.audio.Flags.vgsVssSyncMuteOrder;
import static com.android.server.audio.SoundDoseHelper.ACTION_CHECK_MUSIC_ACTIVE;
import static com.android.server.utils.EventLogger.Event.ALOGE;
import static com.android.server.utils.EventLogger.Event.ALOGI;
@@ -4544,6 +4545,8 @@ public class AudioService extends IAudioService.Stub
                + setStreamVolumeOrder());
        pw.println("\tandroid.media.audio.roForegroundAudioControl:"
                + roForegroundAudioControl());
        pw.println("\tcom.android.media.audio.vgsVssSyncMuteOrder:"
                + vgsVssSyncMuteOrder());
    }
    private void dumpAudioMode(PrintWriter pw) {
@@ -8317,17 +8320,27 @@ public class AudioService extends IAudioService.Stub
                                        synced = true;
                                        continue;
                                    }
                                    if (vgsVssSyncMuteOrder()) {
                                        if ((isMuted() != streamMuted) && isVssMuteBijective(
                                                stream)) {
                                            mStreamStates[stream].mute(isMuted(),
                                                    "VGS.applyAllVolumes#1");
                                        }
                                    }
                                    if (indexForStream != index) {
                                        mStreamStates[stream].setIndex(index * 10, device, caller,
                                                true /*hasModifyAudioSettings*/);
                                    }
                                    if ((isMuted() != streamMuted) && isVssMuteBijective(stream)) {
                                    if (!vgsVssSyncMuteOrder()) {
                                        if ((isMuted() != streamMuted) && isVssMuteBijective(
                                                stream)) {
                                            mStreamStates[stream].mute(isMuted(),
                                                    "VGS.applyAllVolumes#1");
                                        }
                                    }
                                }
                            }
                        }
                        if (!synced) {
                            if (DEBUG_VOL) {
                                Log.d(TAG, "applyAllVolumes: apply index " + index + ", group "