summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2014-08-08 17:42:10 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-07 18:53:12 +0000
commit0fb176417ea9aa899714a434d5599b00b84ff1e3 (patch)
tree65162dcef69d4bc0e5150c06c0c15c56ebb4e148 /core/java
parenta3d98c2508ea14ef2c9a40f9617c9e29cd33a810 (diff)
parent27cb0d22a839f9fc132ae6b4e7c059c75a1826e1 (diff)
downloadframeworks_base-0fb176417ea9aa899714a434d5599b00b84ff1e3.zip
frameworks_base-0fb176417ea9aa899714a434d5599b00b84ff1e3.tar.gz
frameworks_base-0fb176417ea9aa899714a434d5599b00b84ff1e3.tar.bz2
Merge "Make WebViewFactory more robust." into lmp-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/webkit/WebViewFactory.java56
1 files changed, 30 insertions, 26 deletions
diff --git a/core/java/android/webkit/WebViewFactory.java b/core/java/android/webkit/WebViewFactory.java
index d93ca2c..23894ee 100644
--- a/core/java/android/webkit/WebViewFactory.java
+++ b/core/java/android/webkit/WebViewFactory.java
@@ -175,7 +175,9 @@ public final class WebViewFactory {
String[] nativePaths = null;
try {
nativePaths = getWebViewNativeLibraryPaths();
- } catch (PackageManager.NameNotFoundException e) {
+ } catch (Throwable t) {
+ // Log and discard errors at this stage as we must not crash the system server.
+ Log.e(LOGTAG, "error preparing webview native library", t);
}
prepareWebViewInSystemServer(nativePaths);
}
@@ -201,35 +203,37 @@ public final class WebViewFactory {
String[] nativeLibs = null;
try {
nativeLibs = WebViewFactory.getWebViewNativeLibraryPaths();
- } catch (PackageManager.NameNotFoundException e) {
- }
-
- if (nativeLibs != null) {
- long newVmSize = 0L;
-
- for (String path : nativeLibs) {
- if (DEBUG) Log.d(LOGTAG, "Checking file size of " + path);
- if (path == null) continue;
- File f = new File(path);
- if (f.exists()) {
- long length = f.length();
- if (length > newVmSize) {
- newVmSize = length;
+ if (nativeLibs != null) {
+ long newVmSize = 0L;
+
+ for (String path : nativeLibs) {
+ if (DEBUG) Log.d(LOGTAG, "Checking file size of " + path);
+ if (path == null) continue;
+ File f = new File(path);
+ if (f.exists()) {
+ long length = f.length();
+ if (length > newVmSize) {
+ newVmSize = length;
+ }
}
}
- }
- if (DEBUG) {
- Log.v(LOGTAG, "Based on library size, need " + newVmSize +
- " bytes of address space.");
+ if (DEBUG) {
+ Log.v(LOGTAG, "Based on library size, need " + newVmSize +
+ " bytes of address space.");
+ }
+ // The required memory can be larger than the file on disk (due to .bss), and an
+ // upgraded version of the library will likely be larger, so always attempt to
+ // reserve twice as much as we think to allow for the library to grow during this
+ // boot cycle.
+ newVmSize = Math.max(2 * newVmSize, CHROMIUM_WEBVIEW_DEFAULT_VMSIZE_BYTES);
+ Log.d(LOGTAG, "Setting new address space to " + newVmSize);
+ SystemProperties.set(CHROMIUM_WEBVIEW_VMSIZE_SIZE_PROPERTY,
+ Long.toString(newVmSize));
}
- // The required memory can be larger than the file on disk (due to .bss), and an
- // upgraded version of the library will likely be larger, so always attempt to reserve
- // twice as much as we think to allow for the library to grow during this boot cycle.
- newVmSize = Math.max(2 * newVmSize, CHROMIUM_WEBVIEW_DEFAULT_VMSIZE_BYTES);
- Log.d(LOGTAG, "Setting new address space to " + newVmSize);
- SystemProperties.set(CHROMIUM_WEBVIEW_VMSIZE_SIZE_PROPERTY,
- Long.toString(newVmSize));
+ } catch (Throwable t) {
+ // Log and discard errors at this stage as we must not crash the system server.
+ Log.e(LOGTAG, "error preparing webview native library", t);
}
prepareWebViewInSystemServer(nativeLibs);
}