Add support to minimize the WebView's memory consumption by default

webkit change is c/148241

bug:5522175

Change-Id: I8562c39c55913ab89848afe8a36e8a2784c12727
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index e2a521a..0b8191a 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -301,6 +301,13 @@
         // enable smooth transition for better performance during panning or
         // zooming
         settings.setEnableSmoothTransition(true);
+        // WebView should be preserving the memory as much as possible.
+        // However, apps like browser wish to turn on the performance mode which
+        // would require more memory.
+        // TODO: We need to dynamically allocate/deallocate temporary memory for
+        // apps which are trying to use minimal memory. Currently, double
+        // buffering is always turned on, which is unnecessary.
+        settings.setProperty(WebViewProperties.gfxUseMinimalMemory, "false");
         // disable content url access
         settings.setAllowContentAccess(false);
 
diff --git a/src/com/android/browser/WebViewProperties.java b/src/com/android/browser/WebViewProperties.java
index c410038..c662957 100644
--- a/src/com/android/browser/WebViewProperties.java
+++ b/src/com/android/browser/WebViewProperties.java
@@ -19,4 +19,5 @@
     static final String gfxInvertedScreen = "inverted";
     static final String gfxInvertedScreenContrast = "inverted_contrast";
     static final String gfxEnableCpuUploadPath = "enable_cpu_upload_path";
+    static final String gfxUseMinimalMemory = "use_minimal_memory";
 }