diff options
| author | 2023-03-09 16:04:02 -0500 | |
|---|---|---|
| committer | 2023-03-09 22:04:27 +0000 | |
| commit | 3f8dd35901707ee6e0c36b41be413a52b9e1c66a (patch) | |
| tree | 9c132851ee45648d662d61168c9f58b8725b7e06 | |
| parent | 82c8b4e3d0992d06e4277cd4bc723289635af118 (diff) | |
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
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java index 1cfcf8cbbdcb..2892ee3c7643 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java @@ -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); |