Loading core/java/android/webkit/WebView.java +10 −9 Original line number Original line Diff line number Diff line Loading @@ -670,7 +670,6 @@ public class WebView extends AbsoluteLayout */ */ @Deprecated @Deprecated public static void enablePlatformNotifications() { public static void enablePlatformNotifications() { checkThread(); getFactory().getStatics().setPlatformNotificationsEnabled(true); getFactory().getStatics().setPlatformNotificationsEnabled(true); } } Loading @@ -683,7 +682,6 @@ public class WebView extends AbsoluteLayout */ */ @Deprecated @Deprecated public static void disablePlatformNotifications() { public static void disablePlatformNotifications() { checkThread(); getFactory().getStatics().setPlatformNotificationsEnabled(false); getFactory().getStatics().setPlatformNotificationsEnabled(false); } } Loading Loading @@ -1691,7 +1689,6 @@ public class WebView extends AbsoluteLayout * @param enabled whether to enable web contents debugging * @param enabled whether to enable web contents debugging */ */ public static void setWebContentsDebuggingEnabled(boolean enabled) { public static void setWebContentsDebuggingEnabled(boolean enabled) { checkThread(); getFactory().getStatics().setWebContentsDebuggingEnabled(enabled); getFactory().getStatics().setWebContentsDebuggingEnabled(enabled); } } Loading @@ -1704,7 +1701,6 @@ public class WebView extends AbsoluteLayout */ */ @Deprecated @Deprecated public static synchronized PluginList getPluginList() { public static synchronized PluginList getPluginList() { checkThread(); return new PluginList(); return new PluginList(); } } Loading Loading @@ -2058,13 +2054,18 @@ public class WebView extends AbsoluteLayout return WebViewFactory.getProvider(); return WebViewFactory.getProvider(); } } private static void checkThread() { private final Looper mWebViewThread = Looper.myLooper(); if (Looper.myLooper() != Looper.getMainLooper()) { 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( Throwable throwable = new Throwable( "Warning: A WebView method was called on thread '" + "A WebView method was called on thread '" + Thread.currentThread().getName() + "'. " + Thread.currentThread().getName() + "'. " + "All WebView methods must be called on the UI thread. " + "All WebView methods must be called on the same thread. " + "Future versions of WebView may not support use on other threads."); "(Expected Looper " + mWebViewThread + " called on " + Looper.myLooper() + ", FYI main Looper is " + Looper.getMainLooper() + ")"); Log.w(LOGTAG, Log.getStackTraceString(throwable)); Log.w(LOGTAG, Log.getStackTraceString(throwable)); StrictMode.onWebViewMethodCalledOnWrongThread(throwable); StrictMode.onWebViewMethodCalledOnWrongThread(throwable); Loading Loading
core/java/android/webkit/WebView.java +10 −9 Original line number Original line Diff line number Diff line Loading @@ -670,7 +670,6 @@ public class WebView extends AbsoluteLayout */ */ @Deprecated @Deprecated public static void enablePlatformNotifications() { public static void enablePlatformNotifications() { checkThread(); getFactory().getStatics().setPlatformNotificationsEnabled(true); getFactory().getStatics().setPlatformNotificationsEnabled(true); } } Loading @@ -683,7 +682,6 @@ public class WebView extends AbsoluteLayout */ */ @Deprecated @Deprecated public static void disablePlatformNotifications() { public static void disablePlatformNotifications() { checkThread(); getFactory().getStatics().setPlatformNotificationsEnabled(false); getFactory().getStatics().setPlatformNotificationsEnabled(false); } } Loading Loading @@ -1691,7 +1689,6 @@ public class WebView extends AbsoluteLayout * @param enabled whether to enable web contents debugging * @param enabled whether to enable web contents debugging */ */ public static void setWebContentsDebuggingEnabled(boolean enabled) { public static void setWebContentsDebuggingEnabled(boolean enabled) { checkThread(); getFactory().getStatics().setWebContentsDebuggingEnabled(enabled); getFactory().getStatics().setWebContentsDebuggingEnabled(enabled); } } Loading @@ -1704,7 +1701,6 @@ public class WebView extends AbsoluteLayout */ */ @Deprecated @Deprecated public static synchronized PluginList getPluginList() { public static synchronized PluginList getPluginList() { checkThread(); return new PluginList(); return new PluginList(); } } Loading Loading @@ -2058,13 +2054,18 @@ public class WebView extends AbsoluteLayout return WebViewFactory.getProvider(); return WebViewFactory.getProvider(); } } private static void checkThread() { private final Looper mWebViewThread = Looper.myLooper(); if (Looper.myLooper() != Looper.getMainLooper()) { 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( Throwable throwable = new Throwable( "Warning: A WebView method was called on thread '" + "A WebView method was called on thread '" + Thread.currentThread().getName() + "'. " + Thread.currentThread().getName() + "'. " + "All WebView methods must be called on the UI thread. " + "All WebView methods must be called on the same thread. " + "Future versions of WebView may not support use on other threads."); "(Expected Looper " + mWebViewThread + " called on " + Looper.myLooper() + ", FYI main Looper is " + Looper.getMainLooper() + ")"); Log.w(LOGTAG, Log.getStackTraceString(throwable)); Log.w(LOGTAG, Log.getStackTraceString(throwable)); StrictMode.onWebViewMethodCalledOnWrongThread(throwable); StrictMode.onWebViewMethodCalledOnWrongThread(throwable); Loading