From ffe020a093ca464bdc6dd1c8478d7d303c378c12 Mon Sep 17 00:00:00 2001 From: JianYang Liu Date: Tue, 15 Oct 2019 15:38:50 -0700 Subject: [PATCH] Do not cancel car volume dialog dismiss anim A burst of ACTION_OUTSIDE events would cause the dialog dismiss animation to repeatedly cancel and restart before it could finish. Add a flag to keep track of the dismissing state, and let the animation finish once it has started. Change made based on proposal from partner. Bug: 142877093 Test: manual Change-Id: I16a76bd7a65313027751f8f0e223d0346626c37b (cherry picked from commit c8d3ef17af781731b558302efada5c1e7bebd096) --- .../android/systemui/volume/CarVolumeDialogImpl.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java b/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java index d0a63f058291f..22c7c7a3d6af3 100644 --- a/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java +++ b/packages/CarSystemUI/src/com/android/systemui/volume/CarVolumeDialogImpl.java @@ -143,6 +143,7 @@ public class CarVolumeDialogImpl implements VolumeDialog { private boolean mHovering; private int mCurrentlyDisplayingGroupId; private boolean mShowing; + private boolean mDismissing; private boolean mExpanded; private View mExpandIcon; private final ServiceConnection mServiceConnection = new ServiceConnection() { @@ -244,6 +245,7 @@ public class CarVolumeDialogImpl implements VolumeDialog { mHovering = false; mShowing = false; + mDismissing = false; mExpanded = false; mWindow = mDialog.getWindow(); mWindow.requestFeature(Window.FEATURE_NO_TITLE); @@ -335,14 +337,11 @@ public class CarVolumeDialogImpl implements VolumeDialog { mHandler.removeMessages(H.DISMISS); mHandler.removeMessages(H.SHOW); - if (!mShowing) { + if (!mShowing || mDismissing) { return; } - mListView.animate().cancel(); - - mListView.setTranslationY(0); - mListView.setAlpha(1); + mDismissing = true; mListView.animate() .alpha(0) .translationY(-mListView.getHeight()) @@ -354,7 +353,7 @@ public class CarVolumeDialogImpl implements VolumeDialog { } mDialog.dismiss(); mShowing = false; - mShowing = false; + mDismissing = false; // if mExpandIcon is null that means user never clicked on the expanded arrow // which implies that the dialog is still not expanded. In that case we do // not want to reset the state