Commit 57cf1657 authored by Dominic Mazzoni's avatar Dominic Mazzoni Committed by Chromium LUCI CQ

Set timeout for computing AssistData for Android assistant

Android ignores AssistData from Chrome that doesn't arrive within 3.0
seconds. The Assistant team reports that this frequently times out
with Chrome or WebView. To maximize the chances results are returned
in time, set a timeout of 2.0 seconds to get the accessibility tree
snapshot. Our underlying assumption here is that some results are
better than no results.

Note that we already had been using a limit of 5000 nodes, but the time
to populate 5000 nodes wasn't very consistent. Using a timeout will be
much more reliable.

Bug: 1161541
Change-Id: I6dfa7c37f5dc11c5a4ccd69de8533b833de00e99
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2629406Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarMark Schillaci <mschillaci@google.com>
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843880}
parent c59b35b1
......@@ -662,13 +662,16 @@ void WebContentsAndroid::RequestAccessibilitySnapshot(
ScopedJavaGlobalRef<jobject> j_callback;
j_callback.Reset(env, callback);
// Set a timeout of 2.0 seconds to compute the snapshot of the
// accessibility tree because Google Assistant ignores results that
// don't come back within 3.0 seconds.
static_cast<WebContentsImpl*>(web_contents_)
->RequestAXTreeSnapshot(
base::BindOnce(&AXTreeSnapshotCallback, j_callback),
ui::kAXModeComplete,
/* exclude_offscreen= */ false,
/* max_nodes= */ 5000,
/* timeout= */ {});
/* timeout= */ base::TimeDelta::FromSeconds(2));
}
ScopedJavaLocalRef<jstring> WebContentsAndroid::GetEncoding(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment