Fix volume dialog dismiss animation
The root cause of the problem is that within `mController.notifyVisible(false)` `updateActiveStreamW(-1)` is called. This causes the slider to be set to inactive which changes its color. By calling the callback after the animation ended, this problem is fixed. Bug: 240682583 Test: atest VolumeDialogImplTest, Manual, i.e. changing the volume and observing the animation when the VolumeDialog dismisses. Change-Id: I928564202036ce7447d0cbae98302af8bf66c600
This commit is contained in:
@@ -1487,6 +1487,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
|
||||
.setDuration(mDialogHideAnimationDurationMs)
|
||||
.setInterpolator(new SystemUIInterpolators.LogAccelerateInterpolator())
|
||||
.withEndAction(() -> mHandler.postDelayed(() -> {
|
||||
mController.notifyVisible(false);
|
||||
mDialog.dismiss();
|
||||
tryToRemoveCaptionsTooltip();
|
||||
mIsAnimatingDismiss = false;
|
||||
@@ -1497,7 +1498,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
|
||||
animator.setListener(getJankListener(getDialogView(), TYPE_DISMISS,
|
||||
mDialogHideAnimationDurationMs)).start();
|
||||
checkODICaptionsTooltip(true);
|
||||
mController.notifyVisible(false);
|
||||
synchronized (mSafetyWarningLock) {
|
||||
if (mSafetyWarning != null) {
|
||||
if (D.BUG) Log.d(TAG, "SafetyWarning dismissed");
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.systemui.volume;
|
||||
|
||||
import static com.android.systemui.volume.Events.DISMISS_REASON_UNKNOWN;
|
||||
import static com.android.systemui.volume.VolumeDialogControllerImpl.STREAMS;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
@@ -342,6 +343,15 @@ public class VolumeDialogImplTest extends SysuiTestCase {
|
||||
assertEquals(mDialog.mVolumeRingerMuteIconDrawableId, R.drawable.ic_volume_ringer_mute);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDialogDismissAnimation_notifyVisibleIsNotCalledBeforeAnimation() {
|
||||
mDialog.dismissH(DISMISS_REASON_UNKNOWN);
|
||||
// notifyVisible(false) should not be called immediately but only after the dismiss
|
||||
// animation has ended.
|
||||
verify(mVolumeDialogController, times(0)).notifyVisible(false);
|
||||
mDialog.getDialogView().animate().cancel();
|
||||
}
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void testContentDescriptions() {
|
||||
|
||||
Reference in New Issue
Block a user