summaryrefslogtreecommitdiff
path: root/src/com/android/browser/Controller.java
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-12-07 11:11:40 +0000
committerKristian Monsen <kristianm@google.com>2010-12-07 15:10:09 +0000
commit2cd9701de79c8e4e37971498b91ff2530bc58694 (patch)
tree177e2bf0e8d0877e4e0f0c4f6900dfbcb1a413aa /src/com/android/browser/Controller.java
parente800e8e8aebb30817cea989009f3012d6174f1bc (diff)
Clear session cookies in a bg thread
This buys us very little, as we wait on function returning just below. At least we are not doing disk access on the UI thread. Change-Id: I899a795ffbdd2ed63bf6ece70de52cfd48f65a1c
Diffstat (limited to 'src/com/android/browser/Controller.java')
-rw-r--r--src/com/android/browser/Controller.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 7acdfe56..a2caf900 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -249,7 +249,14 @@ public class Controller
mUi.needsRestoreAllTabs())) {
// there is no quit on Android. But if we can't restore the state,
// we can treat it as a new Browser, remove the old session cookies.
- CookieManager.getInstance().removeSessionCookie();
+ AsyncTask cookieCleaningTask = new AsyncTask<Object, Void, Void>() {
+ protected Void doInBackground(Object... none) {
+ CookieManager.getInstance().removeSessionCookie();
+ return null;
+ }
+ };
+ cookieCleaningTask.execute();
+
// remove any incognito files
WebView.cleanupPrivateBrowsingFiles();
final Bundle extra = intent.getExtras();
@@ -277,6 +284,11 @@ public class Controller
}
}
+ // Wait for sessions cookies to be cleared before loading urls
+ try {
+ cookieCleaningTask.get();
+ } catch(InterruptedException e) {
+ } catch(java.util.concurrent.ExecutionException e) {}
if (urlData.isEmpty()) {
loadUrl(webView, mSettings.getHomePage());
} else {