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

Commit 3f8dd359 authored by Alison Cichowlas's avatar Alison Cichowlas
Browse files

Volume: Hide dialog when motion cancelled, as well as when finished.

Speculative fix for issue where sometimes volume dialog does not
ever dismiss. Logs show that VolumeDialogImpl.dismissH is being called,
and the VolumeDialogImpl dump shows that the dialog thinks it is
not showing. I think that these animations are getting cancelled,
leaving mIsAnimatingDismiss true with no active dismiss animation
running (normally it is reset to false during the animation's end
action). mIsAnimatingDismiss then prevents the creation of another
dismiss animation, leaving the dialog stranded.

Test: existing Volume tests pass, no repro available for bug
Bug: 232606092
Change-Id: If6dbccf52de6452ce57d872de40037d5080d8ef0
parent 82c8b4e3
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -1398,7 +1398,11 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
            @Override
            public void onAnimationCancel(@NonNull Animator animation) {
                mInteractionJankMonitor.cancel(CUJ_VOLUME_CONTROL);
                Log.d(TAG, "onAnimationCancel");
                Log.i(TAG, "onAnimationCancel");

                // We can only have one animation listener for cancel, so the jank listener should
                // also call for cleanup.
                finishDismiss();
            }

            @Override
@@ -1490,12 +1494,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
                .setDuration(mDialogHideAnimationDurationMs)
                .setInterpolator(new SystemUIInterpolators.LogAccelerateInterpolator())
                .withEndAction(() -> mHandler.postDelayed(() -> {
                    mController.notifyVisible(false);
                    mDialog.dismiss();
                    tryToRemoveCaptionsTooltip();
                    mIsAnimatingDismiss = false;

                    hideRingerDrawer();
                    finishDismiss();
                }, 50));
        if (!shouldSlideInVolumeTray()) animator.translationX(mDialogView.getWidth() / 2.0f);
        animator.setListener(getJankListener(getDialogView(), TYPE_DISMISS,
@@ -1510,6 +1509,18 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        Trace.endSection();
    }

    /**
     * Clean up and hide volume dialog. Called when animation is finished/cancelled.
     */
    private void finishDismiss() {
        mController.notifyVisible(false);
        mDialog.dismiss();
        tryToRemoveCaptionsTooltip();
        mIsAnimatingDismiss = false;

        hideRingerDrawer();
    }

    private boolean showActiveStreamOnly() {
        return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK)
                || mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEVISION);