From fa4c8e7a5efbe8c5e7284925f15cf9c5585607bc Mon Sep 17 00:00:00 2001 From: Beverly Date: Thu, 10 Aug 2017 14:55:34 -0400 Subject: [PATCH] Previous active volume dialog remains above a11y. When the volume dialog is unexpanded, the a11y volume slider displays below the current active volume stream. Previously, when adjusting a11y volume, the previous active stream's volume dialog row goes out of view once a11y becomes the active stream. This caused the a11y volume dialog row to display strangely. Now, the previous active volume dialog remains above the a11y volume dialog when adjusting a11y volume. Change-Id: Ice09a5c52dc524956bc5acf33f27bfd4a9843400 Fixes: 64326406 Test: manual --- .../android/systemui/volume/VolumeDialogImpl.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java index 7f5c595856493..6e631fa9b926a 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java @@ -134,6 +134,7 @@ public class VolumeDialogImpl implements VolumeDialog, TunerService.Tunable { private boolean mShowA11yStream; private int mActiveStream; + private int mPrevActiveStream; private boolean mAutomute = VolumePrefs.DEFAULT_ENABLE_AUTOMUTE; private boolean mSilentMode = VolumePrefs.DEFAULT_ENABLE_SILENT_MODE; private State mState; @@ -626,10 +627,19 @@ public class VolumeDialogImpl implements VolumeDialog, TunerService.Tunable { } } - private boolean shouldBeVisibleH(VolumeRow row, boolean isActive) { + private boolean shouldBeVisibleH(VolumeRow row, VolumeRow activeRow) { + boolean isActive = row == activeRow; if (row.stream == AudioSystem.STREAM_ACCESSIBILITY) { return mShowA11yStream; } + + // if the active row is accessibility, then continue to display previous + // active row since accessibility is dispalyed under it + if (activeRow.stream == AudioSystem.STREAM_ACCESSIBILITY && + row.stream == mPrevActiveStream) { + return true; + } + return mExpanded && row.view.getVisibility() == View.VISIBLE || (mExpanded && (row.important || isActive)) || !mExpanded && isActive; @@ -643,7 +653,7 @@ public class VolumeDialogImpl implements VolumeDialog, TunerService.Tunable { // apply changes to all rows for (final VolumeRow row : mRows) { final boolean isActive = row == activeRow; - final boolean shouldBeVisible = shouldBeVisibleH(row, isActive); + final boolean shouldBeVisible = shouldBeVisibleH(row, activeRow); Util.setVisOrGone(row.view, shouldBeVisible); Util.setVisOrGone(row.header, shouldBeVisible); if (row.view.isShown()) { @@ -686,6 +696,7 @@ public class VolumeDialogImpl implements VolumeDialog, TunerService.Tunable { } if (mActiveStream != state.activeStream) { + mPrevActiveStream = mActiveStream; mActiveStream = state.activeStream; updateRowsH(getActiveRow()); rescheduleTimeoutH();