diff options
author | Ben Murdoch <benm@google.com> | 2010-11-25 17:17:58 +0000 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-11-26 10:10:33 +0000 |
commit | ef67165a877b1cd17d4afc6e2e17caa97fc399f2 (patch) | |
tree | 718a0a805936360214e65758ea2bce419e81f2fe /src/com/android/browser/BrowserActivity.java | |
parent | 50438d9205f5bebc9f3cefd8e00ae37850e2eb4d (diff) | |
download | packages_apps_browser-ef67165a877b1cd17d4afc6e2e17caa97fc399f2.zip packages_apps_browser-ef67165a877b1cd17d4afc6e2e17caa97fc399f2.tar.gz packages_apps_browser-ef67165a877b1cd17d4afc6e2e17caa97fc399f2.tar.bz2 |
Make BrowserSettings.loadFromDb asynchronous
loadFromDb does a lot of disk IO, including accessing SQLite
and SharedPreferences. This should not be done on the UI thread.
With this patch we move it into an AsyncTask. However there is one
caveat with this solution - all settings must be read and sent to
WebCore before BrowserActivity.onCreate is called so we must block
there if the async task is not complete. This is better than doing
the IO on the UI thread though and fixes a load of Browser StrictMode
violations.
Change-Id: I0ab37ee9e95c682a59d6170a1327ae4ad1deceec
Diffstat (limited to 'src/com/android/browser/BrowserActivity.java')
-rw-r--r-- | src/com/android/browser/BrowserActivity.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java index 97da401..9844547 100644 --- a/src/com/android/browser/BrowserActivity.java +++ b/src/com/android/browser/BrowserActivity.java @@ -52,6 +52,11 @@ public class BrowserActivity extends Activity { } super.onCreate(icicle); + // We load the first set of BrowserSettings from the db asynchronously + // but if it has not completed at this point, we have no choice but + // to block waiting for them to finish loading. :( + BrowserSettings.getInstance().waitForLoadFromDbToComplete(); + // render the browser in OpenGL if (BrowserSettings.getInstance().isHardwareAccelerated()) { // Set the flag in the activity's window |