Loading core/java/android/webkit/WebView.java +8 −4 Original line number Diff line number Diff line Loading @@ -121,8 +121,10 @@ public class WebView extends AbsoluteLayout // 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. // If `alwaysEnforceThreadChecking` flag is true, we will always throw an exception // irrespective of the value of this field. @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) private static volatile boolean sEnforceThreadChecking = false; private static volatile boolean sEnforceThreadChecking = Flags.alwaysEnforceThreadChecking(); /** * Transportation object for returning WebView across thread boundaries. Loading Loading @@ -437,8 +439,10 @@ public class WebView extends AbsoluteLayout throw new RuntimeException( "WebView cannot be initialized on a thread that has no Looper."); } sEnforceThreadChecking = context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2; if (!Flags.alwaysEnforceThreadChecking()) { sEnforceThreadChecking = context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2; } checkThread(); ensureProviderCreated(); Loading Loading @@ -2661,7 +2665,7 @@ public class WebView extends AbsoluteLayout Log.w(LOGTAG, Log.getStackTraceString(throwable)); StrictMode.onWebViewMethodCalledOnWrongThread(throwable); if (sEnforceThreadChecking) { if (Flags.alwaysEnforceThreadChecking() || sEnforceThreadChecking) { throw new RuntimeException(throwable); } } Loading core/java/android/webkit/flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -42,3 +42,10 @@ flag { description: "New APIs required by File System Access" bug: "40101963" } flag { name: "always_enforce_thread_checking" namespace: "webview" description: "Always enforce that WebView APIs are called on the same thread" bug: "440569275" } No newline at end of file Loading
core/java/android/webkit/WebView.java +8 −4 Original line number Diff line number Diff line Loading @@ -121,8 +121,10 @@ public class WebView extends AbsoluteLayout // 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. // If `alwaysEnforceThreadChecking` flag is true, we will always throw an exception // irrespective of the value of this field. @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) private static volatile boolean sEnforceThreadChecking = false; private static volatile boolean sEnforceThreadChecking = Flags.alwaysEnforceThreadChecking(); /** * Transportation object for returning WebView across thread boundaries. Loading Loading @@ -437,8 +439,10 @@ public class WebView extends AbsoluteLayout throw new RuntimeException( "WebView cannot be initialized on a thread that has no Looper."); } sEnforceThreadChecking = context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2; if (!Flags.alwaysEnforceThreadChecking()) { sEnforceThreadChecking = context.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.JELLY_BEAN_MR2; } checkThread(); ensureProviderCreated(); Loading Loading @@ -2661,7 +2665,7 @@ public class WebView extends AbsoluteLayout Log.w(LOGTAG, Log.getStackTraceString(throwable)); StrictMode.onWebViewMethodCalledOnWrongThread(throwable); if (sEnforceThreadChecking) { if (Flags.alwaysEnforceThreadChecking() || sEnforceThreadChecking) { throw new RuntimeException(throwable); } } Loading
core/java/android/webkit/flags.aconfig +7 −0 Original line number Diff line number Diff line Loading @@ -42,3 +42,10 @@ flag { description: "New APIs required by File System Access" bug: "40101963" } flag { name: "always_enforce_thread_checking" namespace: "webview" description: "Always enforce that WebView APIs are called on the same thread" bug: "440569275" } No newline at end of file