Make sure timers are running during pre-login.
Pause/resume timers is really broken. If the user exits the Browser, the process
is still around with paused timers. If pre-login needs to run, timers will be
stalled during the process. This is because there is no current tab during
onResume. Make sure to call resumeTimers and start the cookie sync manager
before handling pre-login.
Bug: 3474608
Change-Id: I12be617947f3ae54a206e31760a2973f81252f50
diff --git a/src/com/android/browser/GoogleAccountLogin.java b/src/com/android/browser/GoogleAccountLogin.java
index 3712490..f4ccfd1 100644
--- a/src/com/android/browser/GoogleAccountLogin.java
+++ b/src/com/android/browser/GoogleAccountLogin.java
@@ -41,6 +41,7 @@
import android.preference.PreferenceManager;
import android.util.Log;
import android.webkit.CookieManager;
+import android.webkit.CookieSyncManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;
@@ -86,6 +87,12 @@
mWebView = new WebView(mActivity);
mRunnable = runnable;
+ // XXX: Doing pre-login causes onResume to skip calling
+ // resumeWebViewTimers. So to avoid problems with timers not running, we
+ // duplicate the work here using the off-screen WebView.
+ CookieSyncManager.getInstance().startSync();
+ mWebView.resumeTimers();
+
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {