diff options
author | John Reck <jreck@google.com> | 2010-12-01 19:29:32 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2010-12-03 10:28:16 -0800 |
commit | 63bb687da46c285f6a71ff47c9f00e46111ffec2 (patch) | |
tree | 900c9b592664af561b12290500e7fc77253bb96c /src/com/android/browser/BrowserSettings.java | |
parent | eff89529627530aef9f7760d8793934ee862470a (diff) | |
download | packages_apps_Browser-63bb687da46c285f6a71ff47c9f00e46111ffec2.zip packages_apps_Browser-63bb687da46c285f6a71ff47c9f00e46111ffec2.tar.gz packages_apps_Browser-63bb687da46c285f6a71ff47c9f00e46111ffec2.tar.bz2 |
Debug settings changes
Bug: 3250498
Makes OpenGL rendering and user agent normally visible in settings->debug
Changing the OpenGL setting now automatically restarts the browser
Change-Id: I04036b580f2463f77376edb4bee2dfefe3d123ed
Diffstat (limited to 'src/com/android/browser/BrowserSettings.java')
-rw-r--r-- | src/com/android/browser/BrowserSettings.java | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java index ba2f3fe..61ef76b 100644 --- a/src/com/android/browser/BrowserSettings.java +++ b/src/com/android/browser/BrowserSettings.java @@ -24,6 +24,7 @@ import android.app.ActivityManager; import android.content.ComponentName; import android.content.ContentResolver; import android.content.Context; +import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.content.pm.ActivityInfo; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; @@ -68,8 +69,7 @@ import java.util.Observable; * To remove an observer: * s.deleteObserver(webView.getSettings()); */ -public class BrowserSettings extends Observable { - +public class BrowserSettings extends Observable implements OnSharedPreferenceChangeListener { // Private variables for settings // NOTE: these defaults need to be kept in sync with the XML // until the performance of PreferenceManager.setDefaultValues() @@ -164,6 +164,8 @@ public class BrowserSettings extends Observable { public final static String PREF_AUTOFILL_ENABLED = "autofill_enabled"; public final static String PREF_AUTOFILL_PROFILE = "autofill_profile"; public final static String PREF_AUTOFILL_ACTIVE_PROFILE_ID = "autofill_active_profile_id"; + public final static String PREF_HARDWARE_ACCEL = "enable_hardware_accel"; + public final static String PREF_USER_AGENT = "user_agent"; private static final String DESKTOP_USERAGENT = "Mozilla/5.0 (Macintosh; " + "U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/533.16 (KHTML, " + @@ -189,6 +191,9 @@ public class BrowserSettings extends Observable { public static final Uri RLZ_PROVIDER_URI = Uri.parse("content://" + RLZ_PROVIDER + "/"); + // Set to true to enable some of the about:debug options + public static final boolean DEV_BUILD = true; + private Controller mController; // Single instance of the BrowserSettings for use in the Browser app. @@ -390,6 +395,7 @@ public class BrowserSettings extends Observable { // PreferenceManager.setDefaultValues is TOO SLOW, need to manually keep // the defaults in sync + p.registerOnSharedPreferenceChangeListener(BrowserSettings.this); syncSharedPreferences(mContext, p); synchronized (sSingleton) { @@ -482,13 +488,13 @@ public class BrowserSettings extends Observable { tracing = p.getBoolean("enable_tracing", tracing); lightTouch = p.getBoolean("enable_light_touch", lightTouch); navDump = p.getBoolean("enable_nav_dump", navDump); - userAgent = Integer.parseInt(p.getString("user_agent", "0")); } - // This setting can only be modified when the debug settings have been - // enabled but it is read and used by the browser at startup so we must - // initialize it regardless of the status of the debug settings. - hardwareAccelerated = p.getBoolean("enable_hardware_accel", hardwareAccelerated); + // Only set these on startup if it is a dev build + if (DEV_BUILD) { + userAgent = Integer.parseInt(p.getString(PREF_USER_AGENT, "0")); + hardwareAccelerated = p.getBoolean(PREF_HARDWARE_ACCEL, hardwareAccelerated); + } // JS flags is loaded from DB even if showDebugSettings is false, // so that it can be set once and be effective all the time. @@ -642,10 +648,10 @@ public class BrowserSettings extends Observable { } /* - * Package level method for obtaining a single app instance of the + * Application level method for obtaining a single app instance of the * BrowserSettings. */ - /*package*/ static BrowserSettings getInstance() { + public static BrowserSettings getInstance() { if (sSingleton == null ) { sSingleton = new BrowserSettings(); } @@ -821,4 +827,15 @@ public class BrowserSettings extends Observable { return null; } } + + @Override + public void onSharedPreferenceChanged( + SharedPreferences p, String key) { + if (PREF_HARDWARE_ACCEL.equals(key)) { + hardwareAccelerated = p.getBoolean(PREF_HARDWARE_ACCEL, hardwareAccelerated); + } else if (PREF_USER_AGENT.equals(key)) { + userAgent = Integer.parseInt(p.getString(PREF_USER_AGENT, "0")); + update(); + } + } } |