From f09838be846f59483f36dc3d96f13064362ea37e Mon Sep 17 00:00:00 2001 From: John Spurlock Date: Thu, 11 Jun 2015 16:14:44 -0400 Subject: A11y: Use a backstop dialog timeout when a11y is enabled. - Or more precisely, whenever a non-generic-only a11y service is enabled. Bug: 21360311 Change-Id: I9e65b7f690d5b670b2d8e944b7d87e0fd1bce327 --- .../com/android/systemui/volume/VolumeDialog.java | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'packages') diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java index 49278c5..aa891b6 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java @@ -17,6 +17,7 @@ package com.android.systemui.volume; import static android.accessibilityservice.AccessibilityServiceInfo.FEEDBACK_ALL_MASK; +import static android.accessibilityservice.AccessibilityServiceInfo.FEEDBACK_GENERIC; import android.accessibilityservice.AccessibilityServiceInfo; import android.animation.LayoutTransition; @@ -422,17 +423,15 @@ public class VolumeDialog { protected void rescheduleTimeoutH() { mHandler.removeMessages(H.DISMISS); - int timeout = -1; - if (!mAccessibility.mFeedbackEnabled) { - timeout = computeTimeoutH(); - mHandler.sendMessageDelayed(mHandler - .obtainMessage(H.DISMISS, Events.DISMISS_REASON_TIMEOUT, 0), timeout); - } + final int timeout = computeTimeoutH(); + mHandler.sendMessageDelayed(mHandler + .obtainMessage(H.DISMISS, Events.DISMISS_REASON_TIMEOUT, 0), timeout); if (D.BUG) Log.d(TAG, "rescheduleTimeout " + timeout + " " + Debug.getCaller()); mController.userActivity(); } private int computeTimeoutH() { + if (mAccessibility.mFeedbackEnabled) return 20000; if (mSafetyWarning != null) return 5000; if (mExpanded || mExpanding) return 5000; if (mActiveStream == AudioManager.STREAM_MUSIC) return 1500; @@ -959,7 +958,7 @@ public class VolumeDialog { } } - private final class Accessibility { + private final class Accessibility extends AccessibilityDelegate { private AccessibilityManager mMgr; private boolean mFeedbackEnabled; @@ -976,14 +975,7 @@ public class VolumeDialog { updateFeedbackEnabled(); } }); - mDialogView.setAccessibilityDelegate(new AccessibilityDelegate() { - @Override - public boolean onRequestSendAccessibilityEvent(ViewGroup host, View child, - AccessibilityEvent event) { - rescheduleTimeoutH(); - return super.onRequestSendAccessibilityEvent(host, child, event); - } - }); + mDialogView.setAccessibilityDelegate(this); mMgr.addAccessibilityStateChangeListener(new AccessibilityStateChangeListener() { @Override public void onAccessibilityStateChanged(boolean enabled) { @@ -993,15 +985,23 @@ public class VolumeDialog { updateFeedbackEnabled(); } + @Override + public boolean onRequestSendAccessibilityEvent(ViewGroup host, View child, + AccessibilityEvent event) { + rescheduleTimeoutH(); + return super.onRequestSendAccessibilityEvent(host, child, event); + } + private void updateFeedbackEnabled() { mFeedbackEnabled = computeFeedbackEnabled(); } private boolean computeFeedbackEnabled() { + // are there any enabled non-generic a11y services? final List services = mMgr.getEnabledAccessibilityServiceList(FEEDBACK_ALL_MASK); for (AccessibilityServiceInfo asi : services) { - if ((asi.feedbackType & FEEDBACK_ALL_MASK) != 0) { + if (asi.feedbackType != 0 && asi.feedbackType != FEEDBACK_GENERIC) { return true; } } -- cgit v1.1