Logging added for ax mode and updated to fix console warnings

Summary: Added logging for accessibility functionality (both usage and performance). Fix to prevent trackTimeSince calls from not matching up to the correct marks. Fix to prevent recursive onElementExpanded calls from mismatching also.

Reviewed By: danielbuechele

Differential Revision: D9229790

fbshipit-source-id: d20f08719d2c4f9a35c9c71a492619ce5538d204
This commit is contained in:
Sara Valderrama
2018-08-10 14:52:56 -07:00
committed by Facebook Github Bot
parent e50bbd861d
commit bf863c3922
3 changed files with 95 additions and 22 deletions

View File

@@ -391,6 +391,11 @@ public class InspectorSonarPlugin implements SonarPlugin {
// if in layout inspector and talkback is running, override the first click to locate the clicked view
if (mConnection != null && AccessibilityUtil.isTalkbackEnabled(getContext()) && event.getPointerCount() == 1) {
SonarObject params = new SonarObject.Builder()
.put("type", "usage")
.put("eventName", "accessibility:clickToInspectTalkbackRunning").build();
mConnection.send("track", params);
final int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_HOVER_ENTER: {

View File

@@ -75,7 +75,8 @@ public class ApplicationDescriptor extends NodeDescriptor<ApplicationWrapper> {
for (View view : node.getViewRoots()) {
// unlikely, but check to make sure accessibility functionality doesn't change
if (view instanceof ViewGroup && !ViewCompat.hasAccessibilityDelegate(view)) {
boolean hasDelegateAlready = ViewCompat.hasAccessibilityDelegate(view);
if (view instanceof ViewGroup && !hasDelegateAlready) {
// add delegate to root to catch accessibility events so we can update focus in sonar
view.setAccessibilityDelegate(new View.AccessibilityDelegate() {
@@ -107,6 +108,11 @@ public class ApplicationDescriptor extends NodeDescriptor<ApplicationWrapper> {
}
});
editedDelegates.add((ViewGroup) view);
} else if (hasDelegateAlready) {
SonarObject params = new SonarObject.Builder()
.put("type", "usage")
.put("eventName", "accessibility:hasDelegateAlready").build();
mConnection.send("track", params);
}
}
}