summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorclchen <clchen@google.com>2012-10-11 16:12:24 -0700
committerclchen <clchen@google.com>2012-10-11 16:13:00 -0700
commit2203cf3f725220e6dc930ee77dbcde4ff7d885b6 (patch)
tree5e89c53adf5a03dfbae30ea2ab3f723b795ffe3c /core/java/android
parent4cce397c0dab44cf7b1b657d0e5410b5970eef55 (diff)
downloadframeworks_base-2203cf3f725220e6dc930ee77dbcde4ff7d885b6.zip
frameworks_base-2203cf3f725220e6dc930ee77dbcde4ff7d885b6.tar.gz
frameworks_base-2203cf3f725220e6dc930ee77dbcde4ff7d885b6.tar.bz2
Reducing WebView navigation timeout for accessibility.
Reducing the amount of time that WebView will wait before treating a navigation attempt as failed. This is needed to recover from cases where the user is attempting to linearly navigate a WebView that is immediately switched out right as it starts to read. A good example of this problem is AdMob's WebViews which are continuously being swapped. Change-Id: Ib9b4a9b99a35d42920e34e0acbe8ab45e1d47871
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/webkit/AccessibilityInjector.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/core/java/android/webkit/AccessibilityInjector.java b/core/java/android/webkit/AccessibilityInjector.java
index d6576e1..37d84b3 100644
--- a/core/java/android/webkit/AccessibilityInjector.java
+++ b/core/java/android/webkit/AccessibilityInjector.java
@@ -710,7 +710,18 @@ class AccessibilityInjector {
"javascript:(function() { %s.onResult(%d, %s); })();";
// Time in milliseconds to wait for a result before failing.
- private static final long RESULT_TIMEOUT = 5000;
+ // Based on recorded times, we have found that in a complex real-world
+ // web app (such as the desktop version of Gmail), there can be spikes
+ // of ~2600ms in the worst case. These are temporary spikes and are not
+ // repeatable; GMail eventually settles down to around ~60ms. The
+ // longest duration that is consistently repeatable is ~300ms when
+ // loading extremely large plain text documents in WebView.
+ // If this timeout hits, the navigation is considered to have "failed",
+ // meaning there is no content. Since the longer spikes are one-off
+ // events triggered by the page loading and itself running a large
+ // amount of JS, subsequent runs would succeed, so the worst impact
+ // is that the first run will look like it had not loaded yet.
+ private static final long RESULT_TIMEOUT = 1500;
private final AtomicInteger mResultIdCounter = new AtomicInteger();
private final Object mResultLock = new Object();