diff options
| author | Jonathan Dixon <joth@google.com> | 2013-10-09 16:32:59 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2013-10-09 16:32:59 -0700 |
| commit | bd88529d282c0b22bf11d09f9134cd47b779d920 (patch) | |
| tree | 6a66624811da083f5d0c03b61004a9e90fe2fc78 /core/java/android | |
| parent | 8cca8b058c4bf425f88be8d354bc47860a76626f (diff) | |
| parent | 1bb6a7dce9df82eb65bc293b3ef387365ef59455 (diff) | |
| download | frameworks_base-bd88529d282c0b22bf11d09f9134cd47b779d920.zip frameworks_base-bd88529d282c0b22bf11d09f9134cd47b779d920.tar.gz frameworks_base-bd88529d282c0b22bf11d09f9134cd47b779d920.tar.bz2 | |
am 1bb6a7dc: am a8137c0c: am b1b2789d: Merge "Do not require WebView usage to come from main thread" into klp-dev
* commit '1bb6a7dce9df82eb65bc293b3ef387365ef59455':
Do not require WebView usage to come from main thread
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/webkit/WebView.java | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 93c3147..f90afef 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -701,7 +701,6 @@ public class WebView extends AbsoluteLayout */ @Deprecated public static void enablePlatformNotifications() { - checkThread(); getFactory().getStatics().setPlatformNotificationsEnabled(true); } @@ -714,7 +713,6 @@ public class WebView extends AbsoluteLayout */ @Deprecated public static void disablePlatformNotifications() { - checkThread(); getFactory().getStatics().setPlatformNotificationsEnabled(false); } @@ -1740,7 +1738,6 @@ public class WebView extends AbsoluteLayout * @param enabled whether to enable web contents debugging */ public static void setWebContentsDebuggingEnabled(boolean enabled) { - checkThread(); getFactory().getStatics().setWebContentsDebuggingEnabled(enabled); } @@ -1753,7 +1750,6 @@ public class WebView extends AbsoluteLayout */ @Deprecated public static synchronized PluginList getPluginList() { - checkThread(); return new PluginList(); } @@ -2107,13 +2103,18 @@ public class WebView extends AbsoluteLayout return WebViewFactory.getProvider(); } - private static void checkThread() { - if (Looper.myLooper() != Looper.getMainLooper()) { + private final Looper mWebViewThread = Looper.myLooper(); + + private void checkThread() { + // Ignore mWebViewThread == null because this can be called during in the super class + // constructor, before this class's own constructor has even started. + if (mWebViewThread != null && Looper.myLooper() != mWebViewThread) { Throwable throwable = new Throwable( - "Warning: A WebView method was called on thread '" + + "A WebView method was called on thread '" + Thread.currentThread().getName() + "'. " + - "All WebView methods must be called on the UI thread. " + - "Future versions of WebView may not support use on other threads."); + "All WebView methods must be called on the same thread. " + + "(Expected Looper " + mWebViewThread + " called on " + Looper.myLooper() + + ", FYI main Looper is " + Looper.getMainLooper() + ")"); Log.w(LOGTAG, Log.getStackTraceString(throwable)); StrictMode.onWebViewMethodCalledOnWrongThread(throwable); |
