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

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

Issue 2903583006: Collect metrics on running Accessibility services on Android (Closed)
Patch Set: Rebase Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content.browser.accessibility; 5 package org.chromium.content.browser.accessibility;
6 6
7 import android.accessibilityservice.AccessibilityServiceInfo;
7 import android.annotation.SuppressLint; 8 import android.annotation.SuppressLint;
8 import android.content.ContentResolver; 9 import android.content.ContentResolver;
9 import android.content.Context; 10 import android.content.Context;
10 import android.graphics.Rect; 11 import android.graphics.Rect;
11 import android.os.Build; 12 import android.os.Build;
12 import android.os.Bundle; 13 import android.os.Bundle;
13 import android.provider.Settings; 14 import android.provider.Settings;
14 import android.text.SpannableString; 15 import android.text.SpannableString;
15 import android.text.style.URLSpan; 16 import android.text.style.URLSpan;
16 import android.view.MotionEvent; 17 import android.view.MotionEvent;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // Source: https://developer.android.com/reference/android/R.id.html 52 // Source: https://developer.android.com/reference/android/R.id.html
52 protected static final int ACTION_CONTEXT_CLICK = 0x0102003c; 53 protected static final int ACTION_CONTEXT_CLICK = 0x0102003c;
53 protected static final int ACTION_SHOW_ON_SCREEN = 0x01020036; 54 protected static final int ACTION_SHOW_ON_SCREEN = 0x01020036;
54 protected static final int ACTION_SCROLL_UP = 0x01020038; 55 protected static final int ACTION_SCROLL_UP = 0x01020038;
55 protected static final int ACTION_SCROLL_DOWN = 0x0102003a; 56 protected static final int ACTION_SCROLL_DOWN = 0x0102003a;
56 protected static final int ACTION_SCROLL_LEFT = 0x01020039; 57 protected static final int ACTION_SCROLL_LEFT = 0x01020039;
57 protected static final int ACTION_SCROLL_RIGHT = 0x0102003b; 58 protected static final int ACTION_SCROLL_RIGHT = 0x0102003b;
58 59
59 private final AccessibilityNodeProvider mAccessibilityNodeProvider; 60 private final AccessibilityNodeProvider mAccessibilityNodeProvider;
60 protected ContentViewCore mContentViewCore; 61 protected ContentViewCore mContentViewCore;
61 private final AccessibilityManager mAccessibilityManager; 62 protected final AccessibilityManager mAccessibilityManager;
62 private final RenderCoordinates mRenderCoordinates; 63 private final RenderCoordinates mRenderCoordinates;
63 private long mNativeObj; 64 private long mNativeObj;
64 private Rect mAccessibilityFocusRect; 65 private Rect mAccessibilityFocusRect;
65 private boolean mIsHovering; 66 private boolean mIsHovering;
66 private int mLastHoverId = View.NO_ID; 67 private int mLastHoverId = View.NO_ID;
67 protected int mCurrentRootId; 68 protected int mCurrentRootId;
68 private final int[] mTempLocation = new int[2]; 69 private final int[] mTempLocation = new int[2];
69 private final ViewGroup mView; 70 private final ViewGroup mView;
70 private boolean mUserHasTouchExplored; 71 private boolean mUserHasTouchExplored;
71 private boolean mPendingScrollToMakeNodeVisible; 72 private boolean mPendingScrollToMakeNodeVisible;
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 if (BuildInfo.isAtLeastO()) { 1207 if (BuildInfo.isAtLeastO()) {
1207 return (Settings.System.getInt(contentResolver, Settings.System.TEXT _SHOW_PASSWORD, 1) 1208 return (Settings.System.getInt(contentResolver, Settings.System.TEXT _SHOW_PASSWORD, 1)
1208 == 1); 1209 == 1);
1209 } 1210 }
1210 1211
1211 return (Settings.Secure.getInt( 1212 return (Settings.Secure.getInt(
1212 contentResolver, Settings.Secure.ACCESSIBILITY_SPEAK_PAS SWORD, 0) 1213 contentResolver, Settings.Secure.ACCESSIBILITY_SPEAK_PAS SWORD, 0)
1213 == 1); 1214 == 1);
1214 } 1215 }
1215 1216
1217 /**
1218 * Iterate over all enabled accessibility services and return a bitmask cont aining the union
1219 * of all event types that they listen to.
1220 * @return
1221 */
1222 @CalledByNative
1223 private int getAccessibilityServiceEventTypeMask() {
1224 int eventTypeMask = 0;
1225 for (AccessibilityServiceInfo service :
1226 mAccessibilityManager.getEnabledAccessibilityServiceList(
1227 AccessibilityServiceInfo.FEEDBACK_ALL_MASK)) {
1228 eventTypeMask |= service.eventTypes;
1229 }
1230 return eventTypeMask;
1231 }
1232
1233 /**
1234 * Iterate over all enabled accessibility services and return a bitmask cont aining the union
1235 * of all feedback types that they provide.
1236 * @return
1237 */
1238 @CalledByNative
1239 private int getAccessibilityServiceFeedbackTypeMask() {
1240 int feedbackTypeMask = 0;
1241 for (AccessibilityServiceInfo service :
1242 mAccessibilityManager.getEnabledAccessibilityServiceList(
1243 AccessibilityServiceInfo.FEEDBACK_ALL_MASK)) {
1244 feedbackTypeMask |= service.feedbackType;
1245 }
1246 return feedbackTypeMask;
1247 }
1248
1249 /**
1250 * Iterate over all enabled accessibility services and return a bitmask cont aining the union
1251 * of all accessibility service flags from any of them.
1252 * @return
1253 */
1254 @CalledByNative
1255 private int getAccessibilityServiceFlagsMask() {
1256 int flagsMask = 0;
1257 for (AccessibilityServiceInfo service :
1258 mAccessibilityManager.getEnabledAccessibilityServiceList(
1259 AccessibilityServiceInfo.FEEDBACK_ALL_MASK)) {
1260 flagsMask |= service.flags;
1261 }
1262 return flagsMask;
1263 }
1264
1265 /**
1266 * Iterate over all enabled accessibility services and return a bitmask cont aining the union
1267 * of all service capabilities.
1268 * @return
1269 */
1270 @CalledByNative
1271 protected int getAccessibilityServiceCapabilitiesMask() {
1272 // Implemented in KitKatBrowserAccessibilityManager.
1273 return 0;
1274 }
1275
1216 private native void nativeOnAutofillPopupDisplayed( 1276 private native void nativeOnAutofillPopupDisplayed(
1217 long nativeBrowserAccessibilityManagerAndroid); 1277 long nativeBrowserAccessibilityManagerAndroid);
1218 private native void nativeOnAutofillPopupDismissed( 1278 private native void nativeOnAutofillPopupDismissed(
1219 long nativeBrowserAccessibilityManagerAndroid); 1279 long nativeBrowserAccessibilityManagerAndroid);
1220 private native int nativeGetIdForElementAfterElementHostingAutofillPopup( 1280 private native int nativeGetIdForElementAfterElementHostingAutofillPopup(
1221 long nativeBrowserAccessibilityManagerAndroid); 1281 long nativeBrowserAccessibilityManagerAndroid);
1222 private native int nativeGetRootId(long nativeBrowserAccessibilityManagerAnd roid); 1282 private native int nativeGetRootId(long nativeBrowserAccessibilityManagerAnd roid);
1223 private native boolean nativeIsNodeValid(long nativeBrowserAccessibilityMana gerAndroid, int id); 1283 private native boolean nativeIsNodeValid(long nativeBrowserAccessibilityMana gerAndroid, int id);
1224 private native boolean nativeIsAutofillPopupNode( 1284 private native boolean nativeIsAutofillPopupNode(
1225 long nativeBrowserAccessibilityManagerAndroid, int id); 1285 long nativeBrowserAccessibilityManagerAndroid, int id);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 long nativeBrowserAccessibilityManagerAndroid, int id); 1319 long nativeBrowserAccessibilityManagerAndroid, int id);
1260 private native boolean nativeIsSlider( 1320 private native boolean nativeIsSlider(
1261 long nativeBrowserAccessibilityManagerAndroid, int id); 1321 long nativeBrowserAccessibilityManagerAndroid, int id);
1262 private native boolean nativeScroll( 1322 private native boolean nativeScroll(
1263 long nativeBrowserAccessibilityManagerAndroid, int id, int direction ); 1323 long nativeBrowserAccessibilityManagerAndroid, int id, int direction );
1264 protected native String nativeGetSupportedHtmlElementTypes( 1324 protected native String nativeGetSupportedHtmlElementTypes(
1265 long nativeBrowserAccessibilityManagerAndroid); 1325 long nativeBrowserAccessibilityManagerAndroid);
1266 private native void nativeShowContextMenu( 1326 private native void nativeShowContextMenu(
1267 long nativeBrowserAccessibilityManagerAndroid, int id); 1327 long nativeBrowserAccessibilityManagerAndroid, int id);
1268 } 1328 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698