From 6251f0d42be7da54d7f1bc8f570a44883b7d9052 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Wed, 1 Apr 2015 16:45:03 -0700 Subject: Rework assist to walk down the view hierarchy. Instead of collecting all of the data directly in AssistStructure, we now have a dispatch mechanism down the hierarchy to do so. While doing this, also added the ability to automatically collect assist data from AccessibilityNodeProviders attached to views (so now we see all of the data in for example Calendar). This is a first step needed towards being able to asynchronously populate assist data. Change-Id: I59ee1ea104ca8207bad8df7a38195d93da1adea7 --- .../com/android/test/voiceinteraction/AssistVisualizer.java | 10 +++++++--- .../android/test/voiceinteraction/MainInteractionSession.java | 1 - 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/AssistVisualizer.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/AssistVisualizer.java index bdc1276..782d112 100644 --- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/AssistVisualizer.java +++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/AssistVisualizer.java @@ -45,6 +45,7 @@ public class AssistVisualizer extends View { } public void setAssistStructure(AssistStructure as) { + mAssistStructure.dump(); mAssistStructure = as; mTextRects.clear(); final int N = as.getWindowNodeCount(); @@ -55,6 +56,7 @@ public class AssistVisualizer extends View { windowNode.getTop()); } } + Log.d(TAG, "Building text rects in " + this + ": found " + mTextRects.size()); invalidate(); } @@ -69,10 +71,11 @@ public class AssistVisualizer extends View { } int left = parentLeft+root.getLeft(); int top = parentTop+root.getTop(); - Log.d(TAG, "View " + root.getClassName() + ": " + left + ", " + top); - if (root.getText() != null) { + if (root.getText() != null || root.getContentDescription() != null) { Rect r = new Rect(left, top, left+root.getWidth(), top+root.getHeight()); - Log.d(TAG, "Text Rect " + r.toShortString() + ": " + root.getText()); + Log.d(TAG, "View " + root.getClassName() + " " + left + "," + top + " tr " + + r.toShortString() + ": " + + (root.getText() != null ? root.getText() : root.getContentDescription())); mTextRects.add(r); } final int N = root.getChildCount(); @@ -91,6 +94,7 @@ public class AssistVisualizer extends View { super.onDraw(canvas); getLocationOnScreen(mTmpLocation); final int N = mTextRects.size(); + Log.d(TAG, "Drawing text rects in " + this + ": found " + mTextRects.size()); for (int i=0; i