Allow HW accleration to be activated on demand.

This CL adds a debugging preference that allows developers to
enable/disable Open GL rendering on demand. The setting change
does not take effect until the browser is restarted.

bug: 3185844
Change-Id: Ifcf5a7b7d4ddbf02a649a28c4f462e2da3f34bb6
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 99de9dc..44842be 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -115,6 +115,7 @@
     private boolean tracing = false;
     private boolean lightTouch = false;
     private boolean navDump = false;
+    private boolean hardwareAccelerated = false;
 
     // By default the error console is shown once the user navigates to about:debug.
     // The setting can be then toggled from the settings menu.
@@ -446,6 +447,12 @@
             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);
+
         // JS flags is loaded from DB even if showDebugSettings is false,
         // so that it can be set once and be effective all the time.
         jsFlags = p.getString("js_engine_flags", "");
@@ -519,6 +526,10 @@
         return navDump;
     }
 
+    public boolean isHardwareAccelerated() {
+        return hardwareAccelerated;
+    }
+
     public boolean showDebugSettings() {
         return showDebugSettings;
     }