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

Commit 0a3a2dd9 authored by Alex Shabalin's avatar Alex Shabalin
Browse files

Fix slider volume rendering for group playback.

The bug is caused by broken slider volume animation. This change
removes the code that tries to start the animation.

Flag: EXEMPT bugfix
Bug: 399845811, 399603559
Fix: 399603559, 399603559
Test: atest SystemUITests:com.android.systemui.media.dialog,
atest SystemUIGoogleScreenshotTests:com.android.systemui.media.dialog

Change-Id: I00c51157dcfad0285ae3bd8946fa9ef423d32457
parent 582fc3ab
Loading
Loading
Loading
Loading
+10 −27
Original line number Diff line number Diff line
@@ -68,7 +68,6 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {
    private final Executor mMainExecutor;
    private final Executor mBackgroundExecutor;
    View mHolderView;
    private boolean mIsInitVolumeFirstTime;

    public MediaOutputAdapterLegacy(
            MediaSwitchingController controller,
@@ -78,7 +77,6 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {
        super(controller);
        mMainExecutor = mainExecutor;
        mBackgroundExecutor = backgroundExecutor;
        mIsInitVolumeFirstTime = true;
    }

    @Override
@@ -261,10 +259,9 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {
                    updateSeekbarProgressBackground();
                }
            }
            boolean isCurrentSeekbarInvisible = mSeekBar.getVisibility() == View.GONE;
            mSeekBar.setVisibility(showSeekBar ? View.VISIBLE : View.GONE);
            if (showSeekBar) {
                initSeekbar(device, isCurrentSeekbarInvisible);
                initSeekbar(device);
                updateContainerContentA11yImportance(false /* isImportant */);
                mSeekBar.setContentDescription(contentDescription);
            } else {
@@ -274,9 +271,8 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {

        void updateGroupSeekBar(String contentDescription) {
            updateSeekbarProgressBackground();
            boolean isCurrentSeekbarInvisible = mSeekBar.getVisibility() == View.GONE;
            mSeekBar.setVisibility(View.VISIBLE);
            initGroupSeekbar(isCurrentSeekbarInvisible);
            initGroupSeekbar();
            updateContainerContentA11yImportance(false /* isImportant */);
            mSeekBar.setContentDescription(contentDescription);
        }
@@ -364,22 +360,13 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {
                            mActiveRadius, 0, 0});
        }

        private void initializeSeekbarVolume(
                @Nullable MediaDevice device, int currentVolume,
                boolean isCurrentSeekbarInvisible) {
        private void initializeSeekbarVolume(@Nullable MediaDevice device, int currentVolume) {
            if (!isDragging()) {
                if (mSeekBar.getVolume() != currentVolume && (mLatestUpdateVolume == -1
                        || currentVolume == mLatestUpdateVolume)) {
                    // Update only if volume of device and value of volume bar doesn't match.
                    // Check if response volume match with the latest request, to ignore obsolete
                    // response
                    if (isCurrentSeekbarInvisible && !mIsInitVolumeFirstTime) {
                        if (currentVolume == 0) {
                            updateMutedVolumeIcon(device);
                        } else {
                            updateUnmutedVolumeIcon(device);
                        }
                    } else {
                    if (!mVolumeAnimator.isStarted()) {
                        if (currentVolume == 0) {
                            updateMutedVolumeIcon(device);
@@ -389,7 +376,6 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {
                        mSeekBar.setVolume(currentVolume);
                        mLatestUpdateVolume = -1;
                    }
                    }
                } else if (currentVolume == 0) {
                    mSeekBar.resetVolume();
                    updateMutedVolumeIcon(device);
@@ -398,12 +384,9 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {
                    mLatestUpdateVolume = -1;
                }
            }
            if (mIsInitVolumeFirstTime) {
                mIsInitVolumeFirstTime = false;
            }
        }

        void initSeekbar(@NonNull MediaDevice device, boolean isCurrentSeekbarInvisible) {
        void initSeekbar(@NonNull MediaDevice device) {
            SeekBarVolumeControl volumeControl = new SeekBarVolumeControl() {
                @Override
                public int getVolume() {
@@ -432,7 +415,7 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {
            }
            mSeekBar.setMaxVolume(device.getMaxVolume());
            final int currentVolume = device.getCurrentVolume();
            initializeSeekbarVolume(device, currentVolume, isCurrentSeekbarInvisible);
            initializeSeekbarVolume(device, currentVolume);

            mSeekBar.setOnSeekBarChangeListener(new MediaSeekBarChangedListener(
                    device, volumeControl) {
@@ -445,7 +428,7 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {
        }

        // Initializes the seekbar for a group of devices.
        void initGroupSeekbar(boolean isCurrentSeekbarInvisible) {
        void initGroupSeekbar() {
            SeekBarVolumeControl volumeControl = new SeekBarVolumeControl() {
                @Override
                public int getVolume() {
@@ -472,7 +455,7 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {
            mSeekBar.setMaxVolume(mController.getSessionVolumeMax());

            final int currentVolume = mController.getSessionVolume();
            initializeSeekbarVolume(null, currentVolume, isCurrentSeekbarInvisible);
            initializeSeekbarVolume(null, currentVolume);
            mSeekBar.setOnSeekBarChangeListener(new MediaSeekBarChangedListener(
                    null, volumeControl) {
                @Override