blob: 1fc6b0b10682767500a708e836f56d44d8b60007 [file] [log] [blame]
The Android Open Source Project0c908882009-03-03 19:32:16 -08001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.browser;
18
Ramanan Rajeswarandd4f4292009-03-24 20:41:19 -070019import com.google.android.providers.GoogleSettings.Partner;
20
The Android Open Source Project0c908882009-03-03 19:32:16 -080021import android.app.Activity;
22import android.content.ContentResolver;
23import android.content.Context;
24import android.content.pm.ActivityInfo;
25import android.content.SharedPreferences;
26import android.content.SharedPreferences.Editor;
27import android.os.SystemProperties;
Nicolas Roard78a98e42009-05-11 13:34:17 +010028import android.preference.PreferenceActivity;
29import android.preference.PreferenceScreen;
30import android.util.Log;
The Android Open Source Project0c908882009-03-03 19:32:16 -080031import android.view.WindowManager;
32import android.webkit.CacheManager;
33import android.webkit.CookieManager;
34import android.webkit.WebView;
35import android.webkit.WebViewDatabase;
36import android.webkit.WebIconDatabase;
37import android.webkit.WebSettings;
Nicolas Roard78a98e42009-05-11 13:34:17 +010038import android.webkit.WebStorage;
The Android Open Source Project0c908882009-03-03 19:32:16 -080039import android.preference.PreferenceManager;
40import android.provider.Browser;
41
42import java.util.HashMap;
43import java.util.Observable;
44
45/*
46 * Package level class for storing various WebView and Browser settings. To use
47 * this class:
48 * BrowserSettings s = BrowserSettings.getInstance();
49 * s.addObserver(webView.getSettings());
50 * s.loadFromDb(context); // Only needed on app startup
51 * s.javaScriptEnabled = true;
52 * ... // set any other settings
53 * s.update(); // this will update all the observers
54 *
55 * To remove an observer:
56 * s.deleteObserver(webView.getSettings());
57 */
58class BrowserSettings extends Observable {
59
Leon Scroggins9ac587d2009-04-20 12:53:46 -040060 // Private variables for settings
The Android Open Source Project0c908882009-03-03 19:32:16 -080061 // NOTE: these defaults need to be kept in sync with the XML
62 // until the performance of PreferenceManager.setDefaultValues()
63 // is improved.
64 private boolean loadsImagesAutomatically = true;
65 private boolean javaScriptEnabled = true;
66 private boolean pluginsEnabled = true;
67 private String pluginsPath; // default value set in loadFromDb().
68 private boolean javaScriptCanOpenWindowsAutomatically = false;
69 private boolean showSecurityWarnings = true;
70 private boolean rememberPasswords = true;
71 private boolean saveFormData = true;
72 private boolean openInBackground = false;
73 private String defaultTextEncodingName;
Grace Klobaf2c5c1b2009-05-26 10:48:31 -070074 private String homeUrl = "";
The Android Open Source Project0c908882009-03-03 19:32:16 -080075 private boolean loginInitialized = false;
76 private boolean autoFitPage = true;
Leon Scrogginsb0cd0722009-03-31 14:31:22 -070077 private boolean landscapeOnly = false;
The Android Open Source Project0c908882009-03-03 19:32:16 -080078 private boolean showDebugSettings = false;
Ben Murdoch092dd5d2009-04-22 12:34:12 +010079 private String databasePath; // default value set in loadFromDb()
80 private boolean databaseEnabled = true;
Nicolas Roard78a98e42009-05-11 13:34:17 +010081 private long webStorageDefaultQuota = 5 * 1024 * 1024;
Andrei Popescu5151ac12009-04-17 10:43:07 +010082 // The Browser always enables Application Caches.
83 private boolean appCacheEnabled = true;
84 private String appCachePath; // default value set in loadFromDb().
Ben Murdoch734a0662009-06-02 19:11:52 +010085 private boolean domStorageEnabled = true;
The Android Open Source Project0c908882009-03-03 19:32:16 -080086
Nicolas Roard78a98e42009-05-11 13:34:17 +010087 private final static String TAG = "BrowserSettings";
88
The Android Open Source Project0c908882009-03-03 19:32:16 -080089 // Development settings
90 public WebSettings.LayoutAlgorithm layoutAlgorithm =
91 WebSettings.LayoutAlgorithm.NARROW_COLUMNS;
92 private boolean useWideViewPort = true;
93 private int userAgent = 0;
94 private boolean tracing = false;
95 private boolean lightTouch = false;
96 private boolean navDump = false;
97 // Browser only settings
98 private boolean doFlick = false;
99
100 // Private preconfigured values
101 private static int minimumFontSize = 8;
102 private static int minimumLogicalFontSize = 8;
103 private static int defaultFontSize = 16;
104 private static int defaultFixedFontSize = 13;
105 private static WebSettings.TextSize textSize =
106 WebSettings.TextSize.NORMAL;
Grace Kloba2f830682009-06-25 11:08:53 -0700107 private static WebSettings.ZoomDensity zoomDensity =
108 WebSettings.ZoomDensity.MEDIUM;
The Android Open Source Project0c908882009-03-03 19:32:16 -0800109
110 // Preference keys that are used outside this class
111 public final static String PREF_CLEAR_CACHE = "privacy_clear_cache";
112 public final static String PREF_CLEAR_COOKIES = "privacy_clear_cookies";
113 public final static String PREF_CLEAR_HISTORY = "privacy_clear_history";
114 public final static String PREF_HOMEPAGE = "homepage";
115 public final static String PREF_CLEAR_FORM_DATA =
116 "privacy_clear_form_data";
117 public final static String PREF_CLEAR_PASSWORDS =
118 "privacy_clear_passwords";
Nicolas Roard78a98e42009-05-11 13:34:17 +0100119 public final static String PREF_DEFAULT_QUOTA =
120 "webstorage_default_quota";
The Android Open Source Project0c908882009-03-03 19:32:16 -0800121 public final static String PREF_EXTRAS_RESET_DEFAULTS =
122 "reset_default_preferences";
123 public final static String PREF_DEBUG_SETTINGS = "debug_menu";
124 public final static String PREF_GEARS_SETTINGS = "gears_settings";
Nicolas Roarde46990e2009-06-19 16:27:49 +0100125 public final static String PREF_WEBSITE_SETTINGS = "website_settings";
The Android Open Source Project0c908882009-03-03 19:32:16 -0800126 public final static String PREF_TEXT_SIZE = "text_size";
Grace Kloba2f830682009-06-25 11:08:53 -0700127 public final static String PREF_DEFAULT_ZOOM = "default_zoom";
The Android Open Source Project0c908882009-03-03 19:32:16 -0800128 public final static String PREF_DEFAULT_TEXT_ENCODING =
129 "default_text_encoding";
130
131 private static final String DESKTOP_USERAGENT = "Mozilla/5.0 (Macintosh; " +
132 "U; Intel Mac OS X 10_5_5; en-us) AppleWebKit/525.18 (KHTML, " +
133 "like Gecko) Version/3.1.2 Safari/525.20.1";
134
135 private static final String IPHONE_USERAGENT = "Mozilla/5.0 (iPhone; U; " +
136 "CPU iPhone OS 2_2 like Mac OS X; en-us) AppleWebKit/525.18.1 " +
137 "(KHTML, like Gecko) Version/3.1.1 Mobile/5G77 Safari/525.20";
138
139 // Value to truncate strings when adding them to a TextView within
140 // a ListView
141 public final static int MAX_TEXTVIEW_LEN = 80;
142
143 private TabControl mTabControl;
144
145 // Single instance of the BrowserSettings for use in the Browser app.
146 private static BrowserSettings sSingleton;
147
148 // Private map of WebSettings to Observer objects used when deleting an
149 // observer.
150 private HashMap<WebSettings,Observer> mWebSettingsToObservers =
151 new HashMap<WebSettings,Observer>();
152
153 /*
154 * An observer wrapper for updating a WebSettings object with the new
155 * settings after a call to BrowserSettings.update().
156 */
157 static class Observer implements java.util.Observer {
158 // Private WebSettings object that will be updated.
159 private WebSettings mSettings;
160
161 Observer(WebSettings w) {
162 mSettings = w;
163 }
164
165 public void update(Observable o, Object arg) {
166 BrowserSettings b = (BrowserSettings)o;
167 WebSettings s = mSettings;
168
169 s.setLayoutAlgorithm(b.layoutAlgorithm);
170 if (b.userAgent == 0) {
171 // use the default ua string
172 s.setUserAgentString(null);
173 } else if (b.userAgent == 1) {
174 s.setUserAgentString(DESKTOP_USERAGENT);
175 } else if (b.userAgent == 2) {
176 s.setUserAgentString(IPHONE_USERAGENT);
177 }
178 s.setUseWideViewPort(b.useWideViewPort);
179 s.setLoadsImagesAutomatically(b.loadsImagesAutomatically);
180 s.setJavaScriptEnabled(b.javaScriptEnabled);
181 s.setPluginsEnabled(b.pluginsEnabled);
The Android Open Source Project0c908882009-03-03 19:32:16 -0800182 s.setJavaScriptCanOpenWindowsAutomatically(
183 b.javaScriptCanOpenWindowsAutomatically);
184 s.setDefaultTextEncodingName(b.defaultTextEncodingName);
185 s.setMinimumFontSize(b.minimumFontSize);
186 s.setMinimumLogicalFontSize(b.minimumLogicalFontSize);
187 s.setDefaultFontSize(b.defaultFontSize);
188 s.setDefaultFixedFontSize(b.defaultFixedFontSize);
189 s.setNavDump(b.navDump);
190 s.setTextSize(b.textSize);
Grace Kloba2f830682009-06-25 11:08:53 -0700191 s.setDefaultZoom(b.zoomDensity);
The Android Open Source Project0c908882009-03-03 19:32:16 -0800192 s.setLightTouchEnabled(b.lightTouch);
193 s.setSaveFormData(b.saveFormData);
194 s.setSavePassword(b.rememberPasswords);
195
196 // WebView inside Browser doesn't want initial focus to be set.
197 s.setNeedInitialFocus(false);
198 // Browser supports multiple windows
199 s.setSupportMultipleWindows(true);
200 // Turn off file access
201 s.setAllowFileAccess(false);
Ben Murdoch092dd5d2009-04-22 12:34:12 +0100202
203 s.setDatabasePath(b.databasePath);
204 s.setDatabaseEnabled(b.databaseEnabled);
Ben Murdoch734a0662009-06-02 19:11:52 +0100205 s.setDomStorageEnabled(b.domStorageEnabled);
Nicolas Roard78a98e42009-05-11 13:34:17 +0100206 s.setWebStorageDefaultQuota(b.webStorageDefaultQuota);
Ben Murdoch092dd5d2009-04-22 12:34:12 +0100207
Andrei Popescu5151ac12009-04-17 10:43:07 +0100208 // Turn on Application Caches.
209 s.setAppCachePath(b.appCachePath);
210 s.setAppCacheEnabled(b.appCacheEnabled);
The Android Open Source Project0c908882009-03-03 19:32:16 -0800211 }
212 }
213
214 /**
215 * Load settings from the browser app's database.
216 * NOTE: Strings used for the preferences must match those specified
217 * in the browser_preferences.xml
218 * @param ctx A Context object used to query the browser's settings
219 * database. If the database exists, the saved settings will be
220 * stored in this BrowserSettings object. This will update all
221 * observers of this object.
222 */
223 public void loadFromDb(Context ctx) {
224 SharedPreferences p =
225 PreferenceManager.getDefaultSharedPreferences(ctx);
226
227 // Set the default value for the plugins path to the application's
228 // local directory.
229 pluginsPath = ctx.getDir("plugins", 0).getPath();
Andrei Popescu5151ac12009-04-17 10:43:07 +0100230 // Set the default value for the Application Caches path.
231 appCachePath = ctx.getDir("appcache", 0).getPath();
Ben Murdoch092dd5d2009-04-22 12:34:12 +0100232 // Set the default value for the Database path.
233 databasePath = ctx.getDir("databases", 0).getPath();
The Android Open Source Project0c908882009-03-03 19:32:16 -0800234
Grace Klobaf2c5c1b2009-05-26 10:48:31 -0700235 homeUrl = getFactoryResetHomeUrl(ctx);
Ramanan Rajeswarandd4f4292009-03-24 20:41:19 -0700236
The Android Open Source Project0c908882009-03-03 19:32:16 -0800237 // Load the defaults from the xml
238 // This call is TOO SLOW, need to manually keep the defaults
239 // in sync
240 //PreferenceManager.setDefaultValues(ctx, R.xml.browser_preferences);
241 syncSharedPreferences(p);
242 }
243
244 /* package */ void syncSharedPreferences(SharedPreferences p) {
Ramanan Rajeswarandd4f4292009-03-24 20:41:19 -0700245
The Android Open Source Project0c908882009-03-03 19:32:16 -0800246 homeUrl =
247 p.getString(PREF_HOMEPAGE, homeUrl);
Ramanan Rajeswarandd4f4292009-03-24 20:41:19 -0700248
The Android Open Source Project0c908882009-03-03 19:32:16 -0800249 loadsImagesAutomatically = p.getBoolean("load_images",
250 loadsImagesAutomatically);
251 javaScriptEnabled = p.getBoolean("enable_javascript",
252 javaScriptEnabled);
253 pluginsEnabled = p.getBoolean("enable_plugins",
254 pluginsEnabled);
255 pluginsPath = p.getString("plugins_path", pluginsPath);
Ben Murdoch092dd5d2009-04-22 12:34:12 +0100256 databasePath = p.getString("database_path", databasePath);
257 databaseEnabled = p.getBoolean("enable_database", databaseEnabled);
Nicolas Roard78a98e42009-05-11 13:34:17 +0100258 webStorageDefaultQuota = Long.parseLong(p.getString(PREF_DEFAULT_QUOTA,
259 String.valueOf(webStorageDefaultQuota)));
Andrei Popescu5151ac12009-04-17 10:43:07 +0100260 appCacheEnabled = p.getBoolean("enable_appcache",
Ben Murdoch734a0662009-06-02 19:11:52 +0100261 appCacheEnabled);
262 domStorageEnabled = p.getBoolean("enable_domstorage",
263 domStorageEnabled);
Andrei Popescu5151ac12009-04-17 10:43:07 +0100264 appCachePath = p.getString("appcache_path", appCachePath);
The Android Open Source Project0c908882009-03-03 19:32:16 -0800265 javaScriptCanOpenWindowsAutomatically = !p.getBoolean(
266 "block_popup_windows",
267 !javaScriptCanOpenWindowsAutomatically);
268 showSecurityWarnings = p.getBoolean("show_security_warnings",
269 showSecurityWarnings);
270 rememberPasswords = p.getBoolean("remember_passwords",
271 rememberPasswords);
272 saveFormData = p.getBoolean("save_formdata",
273 saveFormData);
274 boolean accept_cookies = p.getBoolean("accept_cookies",
275 CookieManager.getInstance().acceptCookie());
276 CookieManager.getInstance().setAcceptCookie(accept_cookies);
277 openInBackground = p.getBoolean("open_in_background", openInBackground);
278 loginInitialized = p.getBoolean("login_initialized", loginInitialized);
279 textSize = WebSettings.TextSize.valueOf(
280 p.getString(PREF_TEXT_SIZE, textSize.name()));
Grace Kloba2f830682009-06-25 11:08:53 -0700281 zoomDensity = WebSettings.ZoomDensity.valueOf(
282 p.getString(PREF_DEFAULT_ZOOM, zoomDensity.name()));
The Android Open Source Project0c908882009-03-03 19:32:16 -0800283 autoFitPage = p.getBoolean("autofit_pages", autoFitPage);
Leon Scrogginsb0cd0722009-03-31 14:31:22 -0700284 boolean landscapeOnlyTemp =
285 p.getBoolean("landscape_only", landscapeOnly);
286 if (landscapeOnlyTemp != landscapeOnly) {
287 landscapeOnly = landscapeOnlyTemp;
288 mTabControl.getBrowserActivity().setRequestedOrientation(
289 landscapeOnly ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
290 : ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
291 }
The Android Open Source Project0c908882009-03-03 19:32:16 -0800292 useWideViewPort = true; // use wide view port for either setting
293 if (autoFitPage) {
294 layoutAlgorithm = WebSettings.LayoutAlgorithm.NARROW_COLUMNS;
295 } else {
296 layoutAlgorithm = WebSettings.LayoutAlgorithm.NORMAL;
297 }
298 defaultTextEncodingName =
299 p.getString(PREF_DEFAULT_TEXT_ENCODING,
300 defaultTextEncodingName);
301
302 showDebugSettings =
303 p.getBoolean(PREF_DEBUG_SETTINGS, showDebugSettings);
304 // Debug menu items have precidence if the menu is visible
305 if (showDebugSettings) {
306 boolean small_screen = p.getBoolean("small_screen",
307 layoutAlgorithm ==
308 WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
309 if (small_screen) {
310 layoutAlgorithm = WebSettings.LayoutAlgorithm.SINGLE_COLUMN;
311 } else {
312 boolean normal_layout = p.getBoolean("normal_layout",
313 layoutAlgorithm == WebSettings.LayoutAlgorithm.NORMAL);
314 if (normal_layout) {
315 layoutAlgorithm = WebSettings.LayoutAlgorithm.NORMAL;
316 } else {
317 layoutAlgorithm =
318 WebSettings.LayoutAlgorithm.NARROW_COLUMNS;
319 }
320 }
321 useWideViewPort = p.getBoolean("wide_viewport", useWideViewPort);
322 tracing = p.getBoolean("enable_tracing", tracing);
323 lightTouch = p.getBoolean("enable_light_touch", lightTouch);
324 navDump = p.getBoolean("enable_nav_dump", navDump);
325 doFlick = p.getBoolean("enable_flick", doFlick);
326 userAgent = Integer.parseInt(p.getString("user_agent", "0"));
327 mTabControl.getBrowserActivity().setBaseSearchUrl(
328 p.getString("search_url", ""));
329 }
330 update();
331 }
332
333 public String getPluginsPath() {
334 return pluginsPath;
335 }
336
337 public String getHomePage() {
338 return homeUrl;
339 }
340
341 public void setHomePage(Context context, String url) {
342 Editor ed = PreferenceManager.
343 getDefaultSharedPreferences(context).edit();
344 ed.putString(PREF_HOMEPAGE, url);
345 ed.commit();
346 homeUrl = url;
347 }
348
349 public boolean isLoginInitialized() {
350 return loginInitialized;
351 }
352
353 public void setLoginInitialized(Context context) {
354 loginInitialized = true;
355 Editor ed = PreferenceManager.
356 getDefaultSharedPreferences(context).edit();
357 ed.putBoolean("login_initialized", loginInitialized);
358 ed.commit();
359 }
360
361 public WebSettings.TextSize getTextSize() {
362 return textSize;
363 }
364
Grace Kloba2f830682009-06-25 11:08:53 -0700365 public WebSettings.ZoomDensity getDefaultZoom() {
366 return zoomDensity;
367 }
368
The Android Open Source Project0c908882009-03-03 19:32:16 -0800369 public boolean openInBackground() {
370 return openInBackground;
371 }
372
373 public boolean showSecurityWarnings() {
374 return showSecurityWarnings;
375 }
376
377 public boolean isTracing() {
378 return tracing;
379 }
380
381 public boolean isLightTouch() {
382 return lightTouch;
383 }
384
385 public boolean isNavDump() {
386 return navDump;
387 }
388
389 public boolean doFlick() {
390 return doFlick;
391 }
392
393 public boolean showDebugSettings() {
394 return showDebugSettings;
395 }
396
397 public void toggleDebugSettings() {
398 showDebugSettings = !showDebugSettings;
399 navDump = showDebugSettings;
400 update();
401 }
402
403 /**
404 * Add a WebSettings object to the list of observers that will be updated
405 * when update() is called.
406 *
407 * @param s A WebSettings object that is strictly tied to the life of a
408 * WebView.
409 */
410 public Observer addObserver(WebSettings s) {
411 Observer old = mWebSettingsToObservers.get(s);
412 if (old != null) {
413 super.deleteObserver(old);
414 }
415 Observer o = new Observer(s);
416 mWebSettingsToObservers.put(s, o);
417 super.addObserver(o);
418 return o;
419 }
420
421 /**
422 * Delete the given WebSettings observer from the list of observers.
423 * @param s The WebSettings object to be deleted.
424 */
425 public void deleteObserver(WebSettings s) {
426 Observer o = mWebSettingsToObservers.get(s);
427 if (o != null) {
428 mWebSettingsToObservers.remove(s);
429 super.deleteObserver(o);
430 }
431 }
432
433 /*
434 * Package level method for obtaining a single app instance of the
435 * BrowserSettings.
436 */
437 /*package*/ static BrowserSettings getInstance() {
438 if (sSingleton == null ) {
439 sSingleton = new BrowserSettings();
440 }
441 return sSingleton;
442 }
443
444 /*
445 * Package level method for associating the BrowserSettings with TabControl
446 */
447 /* package */void setTabControl(TabControl tabControl) {
448 mTabControl = tabControl;
449 }
450
451 /*
452 * Update all the observers of the object.
453 */
454 /*package*/ void update() {
455 setChanged();
456 notifyObservers();
457 }
458
459 /*package*/ void clearCache(Context context) {
460 WebIconDatabase.getInstance().removeAllIcons();
461 if (mTabControl != null) {
462 WebView current = mTabControl.getCurrentWebView();
463 if (current != null) {
464 current.clearCache(true);
465 }
466 }
467 }
468
469 /*package*/ void clearCookies(Context context) {
470 CookieManager.getInstance().removeAllCookie();
471 }
472
473 /* package */void clearHistory(Context context) {
474 ContentResolver resolver = context.getContentResolver();
475 Browser.clearHistory(resolver);
476 Browser.clearSearches(resolver);
477 }
478
479 /* package */ void clearFormData(Context context) {
480 WebViewDatabase.getInstance(context).clearFormData();
481 if (mTabControl != null) {
482 mTabControl.getCurrentTopWebView().clearFormData();
483 }
484 }
485
486 /*package*/ void clearPasswords(Context context) {
487 WebViewDatabase db = WebViewDatabase.getInstance(context);
488 db.clearUsernamePassword();
489 db.clearHttpAuthUsernamePassword();
490 }
491
Nicolas Roard78a98e42009-05-11 13:34:17 +0100492 /*package*/ void clearDatabases(Context context) {
493 WebStorage.getInstance().deleteAllDatabases();
494 // Remove all listed databases from the preferences
495 PreferenceActivity activity = (PreferenceActivity) context;
496 PreferenceScreen screen = (PreferenceScreen)
Nicolas Roarde46990e2009-06-19 16:27:49 +0100497 activity.findPreference(BrowserSettings.PREF_WEBSITE_SETTINGS);
Nicolas Roard78a98e42009-05-11 13:34:17 +0100498 screen.removeAll();
Nicolas Roard6f480422009-05-12 16:31:33 +0100499 screen.setEnabled(false);
Nicolas Roard78a98e42009-05-11 13:34:17 +0100500 }
501
Leon Scroggins9ac587d2009-04-20 12:53:46 -0400502 /*package*/ void resetDefaultPreferences(Context ctx) {
The Android Open Source Project0c908882009-03-03 19:32:16 -0800503 SharedPreferences p =
Leon Scroggins9ac587d2009-04-20 12:53:46 -0400504 PreferenceManager.getDefaultSharedPreferences(ctx);
The Android Open Source Project0c908882009-03-03 19:32:16 -0800505 p.edit().clear().commit();
Leon Scroggins9ac587d2009-04-20 12:53:46 -0400506 PreferenceManager.setDefaultValues(ctx, R.xml.browser_preferences,
The Android Open Source Project0c908882009-03-03 19:32:16 -0800507 true);
Grace Klobaf2c5c1b2009-05-26 10:48:31 -0700508 // reset homeUrl
Grace Klobaa3f90f02009-05-26 11:32:53 -0700509 setHomePage(ctx, getFactoryResetHomeUrl(ctx));
Grace Klobaf2c5c1b2009-05-26 10:48:31 -0700510 }
511
512 private String getFactoryResetHomeUrl(Context context) {
513 String url = context.getResources().getString(R.string.homepage_base);
514 if (url.indexOf("{CID}") != -1) {
515 url = url.replace("{CID}", Partner.getString(context
Ramanan Rajeswaran9768ac52009-06-03 19:34:58 -0700516 .getContentResolver(), Partner.CLIENT_ID, "android-google"));
Grace Klobaf2c5c1b2009-05-26 10:48:31 -0700517 }
518 return url;
The Android Open Source Project0c908882009-03-03 19:32:16 -0800519 }
520
521 // Private constructor that does nothing.
522 private BrowserSettings() {
523 }
524}