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

Commit 0f31fe09 authored by Eric Laurent's avatar Eric Laurent
Browse files

Issue 3371080: fix volume update in mute state.

VolumePreference should take the stream mute state into account
when updating the progress bar if a change is received by
the content observer

Change-Id: Ia1a8af9d4cc349d2d57753d865e8d2e58daf04f1
parent cc84ea17
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -236,16 +236,13 @@ public class VolumePreference extends SeekBarPreference implements
            @Override
            public void onChange(boolean selfChange) {
                super.onChange(selfChange);
                if (mSeekBar != null) {
                    int volume = System.getInt(mContext.getContentResolver(),
                            System.VOLUME_SETTINGS[mStreamType], -1);
                    // Works around an atomicity problem with volume updates
                    // TODO: Fix the actual issue, probably in AudioService
                    if (volume >= 0) {
                if (mSeekBar != null && mAudioManager != null) {
                    int volume = mAudioManager.isStreamMute(mStreamType) ?
                            mAudioManager.getLastAudibleStreamVolume(mStreamType)
                            : mAudioManager.getStreamVolume(mStreamType);
                    mSeekBar.setProgress(volume);
                }
            }
            }
        };

        public SeekBarVolumizer(Context context, SeekBar seekBar, int streamType) {