Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(848)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java

Issue 2881723002: Fix TalkBack feedback for password fields in Android O (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java
index e2a86227b12407c3f13736dec3650febafa107e6..1c2f3470d84dc9c7b37970c04959cd57c2edebe1 100644
--- a/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java
+++ b/content/public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java
@@ -21,6 +21,7 @@ import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityNodeProvider;
+import org.chromium.base.BuildInfo;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.content.browser.ContentViewCore;
@@ -1030,7 +1031,8 @@ public class BrowserAccessibilityManager {
@CalledByNative
protected void setAccessibilityNodeInfoKitKatAttributes(AccessibilityNodeInfo node,
- boolean isRoot, boolean isEditableText, String roleDescription) {
+ boolean isRoot, boolean isEditableText, String roleDescription, int selectionStartIndex,
+ int selectionEndIndex) {
// Requires KitKat or higher.
}
@@ -1176,8 +1178,31 @@ public class BrowserAccessibilityManager {
bundle.putFloat("AccessibilityNodeInfo.RangeInfo.current", current);
}
+ /**
+ * On Android O and higher, we should respect whatever is displayed
+ * in a password box and report that via accessibility APIs, whether
+ * that's the unobscured password, or all dots.
+ *
+ * Previous to O, shouldExposePasswordText() returns a system setting
+ * that determines whether we should return the unobscured password or all
+ * dots, independent of what was displayed visually.
+ */
+ @CalledByNative
+ boolean shouldRespectDisplayedPasswordText() {
+ return BuildInfo.isAtLeastO();
+ }
+
+ /**
+ * Only relevant prior to Android O, see shouldRespectDisplayedPasswordText.
+ */
@CalledByNative
boolean shouldExposePasswordText() {
+ if (BuildInfo.isAtLeastO()) {
+ return (Settings.System.getInt(mContentViewCore.getContext().getContentResolver(),
aboxhall 2017/05/12 07:09:34 Suggestion: pull this out into a local var to make
dmazzoni 2017/05/12 07:43:09 Done, but git cl format still does it a bit weird.
+ Settings.System.TEXT_SHOW_PASSWORD, 1)
+ == 1);
+ }
+
return (Settings.Secure.getInt(
mContentViewCore.getContext().getContentResolver(),
Settings.Secure.ACCESSIBILITY_SPEAK_PASSWORD, 0) == 1);

Powered by Google App Engine
This is Rietveld 408576698