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

Commit b8a937e0 authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "AudioService: Fix STREAM_MUSIC volume persistence across reboot" into main

parents e33433e8 bf0df330
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -10155,7 +10155,7 @@ public class AudioService extends IAudioService.Stub
                    } else {
                        String name = getSettingNameForDevice(device);
                        index = mSettings.getSystemIntForUser(
                                mContentResolver, name, defaultIndex, UserHandle.USER_CURRENT);
                                mContentResolver, name, defaultIndex, getVolumePersistenceUserId());
                    }
                    if (index == -1) {
                        continue;
@@ -10457,6 +10457,13 @@ public class AudioService extends IAudioService.Stub
            return isPrivileged ? mIndexMin : mIndexMinNoPerm;
        }
        @UserIdInt
        private int getVolumePersistenceUserId() {
            return mStreamType == AudioSystem.STREAM_MUSIC && !isPlatformAutomotive()
                    ? UserHandle.USER_SYSTEM
                    : UserHandle.USER_CURRENT;
        }
        /**
         * Copies all device/index pairs from the given VolumeStreamState after initializing
         * them with the volume for DEVICE_OUT_DEFAULT. No-op if the source VolumeStreamState
@@ -10899,7 +10906,7 @@ public class AudioService extends IAudioService.Stub
                mSettings.putSystemIntForUser(mContentResolver,
                        streamState.getSettingNameForDevice(device),
                        (streamState.getIndex(device) + 5) / 10,
                        UserHandle.USER_CURRENT);
                        streamState.getVolumePersistenceUserId());
            }
        }