diff options
author | Ben Murdoch <benm@google.com> | 2011-07-28 17:47:22 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-07-29 16:52:36 +0100 |
commit | 9bbd9314fee5f284ff254d7063c30d147fe47454 (patch) | |
tree | a4879e24fc48ca630a65d0f144037b03b2932c18 | |
parent | 6d598844158407f5966bdef959a74e86e73f0c1a (diff) | |
download | android_packages_apps_Gello-9bbd9314fee5f284ff254d7063c30d147fe47454.tar.gz android_packages_apps_Gello-9bbd9314fee5f284ff254d7063c30d147fe47454.tar.bz2 android_packages_apps_Gello-9bbd9314fee5f284ff254d7063c30d147fe47454.zip |
Fix strict mode violation in GoogleAccountLogin
Do not call WebView methods from a background thread.
Bug: 5090601
Change-Id: If72d86c6a68932787b14d7eb11c3a351ac1f8385
-rw-r--r-- | src/com/android/browser/GoogleAccountLogin.java | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/com/android/browser/GoogleAccountLogin.java b/src/com/android/browser/GoogleAccountLogin.java index 38965601..2bd3c8c7 100644 --- a/src/com/android/browser/GoogleAccountLogin.java +++ b/src/com/android/browser/GoogleAccountLogin.java @@ -67,6 +67,7 @@ public class GoogleAccountLogin implements Runnable, private String mLsid; private int mState; // {NONE(0), SID(1), LSID(2)} private boolean mTokensInvalidated; + private String mUserAgent; private GoogleAccountLogin(Activity activity, Account account, Runnable runnable) { @@ -74,6 +75,7 @@ public class GoogleAccountLogin implements Runnable, mAccount = account; mWebView = new WebView(mActivity); mRunnable = runnable; + mUserAgent = mWebView.getSettings().getUserAgentString(); // XXX: Doing pre-login causes onResume to skip calling // resumeWebViewTimers. So to avoid problems with timers not running, we @@ -106,17 +108,8 @@ public class GoogleAccountLogin implements Runnable, .appendQueryParameter("SID", mSid) .appendQueryParameter("LSID", mLsid) .build().toString(); - // Check mRunnable to see if the request has been canceled. Otherwise - // we might access a destroyed WebView. - String ua = null; - synchronized (this) { - if (mRunnable == null) { - return; - } - ua = mWebView.getSettings().getUserAgentString(); - } // Intentionally not using Proxy. - AndroidHttpClient client = AndroidHttpClient.newInstance(ua); + AndroidHttpClient client = AndroidHttpClient.newInstance(mUserAgent); HttpPost request = new HttpPost(url); String result = null; |