diff options
author | Kristian Monsen <kristianm@google.com> | 2013-04-11 21:53:52 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-04-11 21:53:52 -0700 |
commit | 3b9e272e0e2f01d55e67c68dbf5b6e9d895508f4 (patch) | |
tree | 93ef0ccc1fef7cb2ccba57aa0243c29ca46cf74d /core | |
parent | dc5711eaef8662d5299f0088edf6e47fff77a872 (diff) | |
parent | 83b002584ce27e3f405d224c0ce83d69516f87d8 (diff) | |
download | frameworks_base-3b9e272e0e2f01d55e67c68dbf5b6e9d895508f4.zip frameworks_base-3b9e272e0e2f01d55e67c68dbf5b6e9d895508f4.tar.gz frameworks_base-3b9e272e0e2f01d55e67c68dbf5b6e9d895508f4.tar.bz2 |
am 83b00258: Merge "Fix for bug 8577776 Throw exception if app calls WebView used on wrong thread" into jb-mr2-dev
* commit '83b002584ce27e3f405d224c0ce83d69516f87d8':
Fix for bug 8577776 Throw exception if app calls WebView used on wrong thread
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/webkit/WebView.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 1f00c9c..afa4894 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -26,6 +26,7 @@ import android.graphics.Picture; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.net.http.SslCertificate; +import android.os.Build; import android.os.Bundle; import android.os.Looper; import android.os.Message; @@ -241,6 +242,11 @@ public class WebView extends AbsoluteLayout private static final String LOGTAG = "webview_proxy"; + // Throwing an exception for incorrect thread usage if the + // build target is JB MR2 or newer. Defaults to false, and is + // set in the WebView constructor. + private static Boolean sEnforceThreadChecking = false; + /** * Transportation object for returning WebView across thread boundaries. */ @@ -483,6 +489,8 @@ public class WebView extends AbsoluteLayout if (context == null) { throw new IllegalArgumentException("Invalid context argument"); } + sEnforceThreadChecking = context.getApplicationInfo().targetSdkVersion >= + Build.VERSION_CODES.JELLY_BEAN_MR2; checkThread(); ensureProviderCreated(); @@ -1915,6 +1923,10 @@ public class WebView extends AbsoluteLayout "Future versions of WebView may not support use on other threads."); Log.w(LOGTAG, Log.getStackTraceString(throwable)); StrictMode.onWebViewMethodCalledOnWrongThread(throwable); + + if (sEnforceThreadChecking) { + throw new RuntimeException(throwable); + } } } |