summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2015-04-01 16:45:03 -0700
committerDianne Hackborn <hackbod@google.com>2015-04-01 17:08:27 -0700
commit6251f0d42be7da54d7f1bc8f570a44883b7d9052 (patch)
treed7e928e1d55745a3ff4771c546678e4b27fc6d1b /tests
parent6cedefa2e4a10724982a72e22abc349c7578902d (diff)
downloadframeworks_base-6251f0d42be7da54d7f1bc8f570a44883b7d9052.zip
frameworks_base-6251f0d42be7da54d7f1bc8f570a44883b7d9052.tar.gz
frameworks_base-6251f0d42be7da54d7f1bc8f570a44883b7d9052.tar.bz2
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
Diffstat (limited to 'tests')
-rw-r--r--tests/VoiceInteraction/src/com/android/test/voiceinteraction/AssistVisualizer.java10
-rw-r--r--tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java1
2 files changed, 7 insertions, 4 deletions
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<N; i++) {
Rect r = mTextRects.get(i);
canvas.drawRect(r.left-mTmpLocation[0], r.top-mTmpLocation[1],
diff --git a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
index bc18ca9..ec727c4 100644
--- a/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
+++ b/tests/VoiceInteraction/src/com/android/test/voiceinteraction/MainInteractionSession.java
@@ -142,7 +142,6 @@ public class MainInteractionSession extends VoiceInteractionSession
if (assistContext != null) {
mAssistStructure = AssistStructure.getAssistStructure(assistContext);
if (mAssistStructure != null) {
- mAssistStructure.dump();
if (mAssistVisualizer != null) {
mAssistVisualizer.setAssistStructure(mAssistStructure);
}