diff options
| author | Ben Murdoch <benm@google.com> | 2011-07-25 09:38:43 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-07-25 09:38:43 -0700 |
| commit | 420d149566e19f1663db69420375b6dd1f0acd6f (patch) | |
| tree | 5ae789cb68c7b9d91f7a510461157a2d45d3e128 /src/com/android/browser/BrowserSettings.java | |
| parent | c8b708c379ec8ef47772d186fefe385ef7e12359 (diff) | |
| parent | aaa1f375bc9d6a6a175819fac34d39202f69a166 (diff) | |
| download | packages_apps_Browser-420d149566e19f1663db69420375b6dd1f0acd6f.tar.gz packages_apps_Browser-420d149566e19f1663db69420375b6dd1f0acd6f.tar.bz2 packages_apps_Browser-420d149566e19f1663db69420375b6dd1f0acd6f.zip | |
Merge changes I78550965,I6e0fe0ba,Ia6db6cf3
* changes:
Cache the factory reset URL.
Fix StrictMode violation in InstantSearchEngine
Query Private Browsing state for NFC on UI thread.
Diffstat (limited to 'src/com/android/browser/BrowserSettings.java')
| -rw-r--r-- | src/com/android/browser/BrowserSettings.java | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java index a4f0f044b..2023ee61e 100644 --- a/src/com/android/browser/BrowserSettings.java +++ b/src/com/android/browser/BrowserSettings.java @@ -103,7 +103,7 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener, private WebStorageSizeManager mWebStorageSizeManager; private AutofillHandler mAutofillHandler; private WeakHashMap<WebSettings, String> mCustomUserAgents; - private boolean mInitialized = false; + private static boolean sInitialized = false; // Looper shared between some lightweight background operations // Specifically, this is created on the thread that initializes browser settings // and is then reused by CrashRecoveryHandler @@ -116,6 +116,8 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener, // Cached settings private SearchEngine mSearchEngine; + private static String sFactoryResetUrl; + public static void initialize(final Context context) { sInstance = new BrowserSettings(context); } @@ -199,21 +201,28 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener, } mPrefs.edit().remove(PREF_TEXT_SIZE).apply(); } + + sFactoryResetUrl = mContext.getResources().getString(R.string.homepage_base); + if (sFactoryResetUrl.indexOf("{CID}") != -1) { + sFactoryResetUrl = sFactoryResetUrl.replace("{CID}", + BrowserProvider.getClientId(mContext.getContentResolver())); + } + Looper.prepare(); mBackgroundLooper = Looper.myLooper(); - synchronized (BrowserSettings.this) { - mInitialized = true; - BrowserSettings.this.notifyAll(); + synchronized (BrowserSettings.class) { + sInitialized = true; + BrowserSettings.class.notifyAll(); } Looper.loop(); } }; - void requireInitialization() { - synchronized (BrowserSettings.this) { - while (!mInitialized) { + private static void requireInitialization() { + synchronized (BrowserSettings.class) { + while (!sInitialized) { try { - BrowserSettings.this.wait(); + BrowserSettings.class.wait(); } catch (InterruptedException e) { } } @@ -334,12 +343,8 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener, } public static String getFactoryResetHomeUrl(Context context) { - String url = context.getResources().getString(R.string.homepage_base); - if (url.indexOf("{CID}") != -1) { - url = url.replace("{CID}", - BrowserProvider.getClientId(context.getContentResolver())); - } - return url; + requireInitialization(); + return sFactoryResetUrl; } public LayoutAlgorithm getLayoutAlgorithm() { |
