From 1cf8906231ff281dab360fc6190aa0633bb9ed18 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Fri, 29 Aug 2014 19:21:44 +0200 Subject: [PATCH] Not enforcing a timeout anymore for talkback users When displaying the volume warning for talkback users no timeout is enforced anymore. Bug: 17145793 Change-Id: I87c3baa6caf835bceda284cd7d89ca59fdc190f5 --- .../android/systemui/volume/VolumePanel.java | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java index 12c887ef27cee..5da868102f5d0 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java @@ -96,7 +96,6 @@ public class VolumePanel extends Handler { private static final int TIMEOUT_DELAY_SHORT = 1500; private static final int TIMEOUT_DELAY_COLLAPSED = 4500; private static final int TIMEOUT_DELAY_SAFETY_WARNING = 5000; - private static final int TIMEOUT_DELAY_SAFETY_WARNING_TALKBACK = 25000; private static final int TIMEOUT_DELAY_EXPANDED = 10000; private static final int MSG_VOLUME_CHANGED = 0; @@ -794,8 +793,7 @@ public class VolumePanel extends Handler { } private void updateTimeoutDelay() { - mTimeoutDelay = sSafetyWarning != null ? mAccessibilityManager.isEnabled() ? - TIMEOUT_DELAY_SAFETY_WARNING_TALKBACK : TIMEOUT_DELAY_SAFETY_WARNING + mTimeoutDelay = sSafetyWarning != null ? TIMEOUT_DELAY_SAFETY_WARNING : mActiveStreamType == AudioManager.STREAM_MUSIC ? TIMEOUT_DELAY_SHORT : mZenPanelExpanded ? TIMEOUT_DELAY_EXPANDED : isZenPanelVisible() ? TIMEOUT_DELAY_COLLAPSED @@ -1218,8 +1216,12 @@ public class VolumePanel extends Handler { } updateStates(); } - updateTimeoutDelay(); - resetTimeout(); + if (mAccessibilityManager.isTouchExplorationEnabled()) { + removeMessages(MSG_TIMEOUT); + } else { + updateTimeoutDelay(); + resetTimeout(); + } } /** @@ -1373,10 +1375,12 @@ public class VolumePanel extends Handler { private void resetTimeout() { if (LOGD) Log.d(mTag, "resetTimeout at " + System.currentTimeMillis() + " delay=" + mTimeoutDelay); - removeMessages(MSG_TIMEOUT); - sendEmptyMessageDelayed(MSG_TIMEOUT, mTimeoutDelay); - removeMessages(MSG_USER_ACTIVITY); - sendEmptyMessage(MSG_USER_ACTIVITY); + if (sSafetyWarning == null || !mAccessibilityManager.isTouchExplorationEnabled()) { + removeMessages(MSG_TIMEOUT); + sendEmptyMessageDelayed(MSG_TIMEOUT, mTimeoutDelay); + removeMessages(MSG_USER_ACTIVITY); + sendEmptyMessage(MSG_USER_ACTIVITY); + } } private void forceTimeout(long delay) {