Skip to content

Commit

Permalink
Fix crashes in Webview Browser during MonkeyTest
Browse files Browse the repository at this point in the history
Getting below crash when running monkey test-:
1) java.lang.RuntimeException: StrictMode ThreadPolicy violation
   Caused by: android.os.strictmode.DiskReadViolation
2) java.lang.RuntimeException: StrictMode ThreadPolicy violation
   Caused by: android.os.strictmode.UnbufferedIoViolation

Allow DiskRead and UnbufferedIo in StrictMode builder.

Tracked-On: OAM-123134
Signed-off-by: Salini Venate <[email protected]>
Signed-off-by: Xu Bing <[email protected]>
  • Loading branch information
XuBing0 committed Aug 8, 2024
1 parent e8f3526 commit d476c89
Showing 1 changed file with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
From 3ef99242c9f0a9e87f04744cedcc9f16aaabea13 Mon Sep 17 00:00:00 2001
From: Salini Venate <[email protected]>
Date: Tue, 27 Feb 2024 09:29:30 +0530
Subject: [PATCH] Fix crashes in Webview Browser during MonkeyTest

Getting below crash when running monkey test-:
1) java.lang.RuntimeException: StrictMode ThreadPolicy violation
Caused by: android.os.strictmode.DiskReadViolation
2) java.lang.RuntimeException: StrictMode ThreadPolicy violation
Caused by: android.os.strictmode.UnbufferedIoViolation

Allow DiskRead and UnbufferedIo in StrictMode builder.

Tracked-On: OAM-123134
Signed-off-by: Salini Venate <[email protected]>
Signed-off-by: Xu Bing <[email protected]>
---
src/org/chromium/webview_shell/WebViewBrowserActivity.java | 2 ++
1 file changed, 2 insertions(+)

diff --git a/src/org/chromium/webview_shell/WebViewBrowserActivity.java b/src/org/chromium/webview_shell/WebViewBrowserActivity.java
index d39db6a..c8e95ab 100644
--- a/src/org/chromium/webview_shell/WebViewBrowserActivity.java
+++ b/src/org/chromium/webview_shell/WebViewBrowserActivity.java
@@ -243,6 +243,8 @@ public class WebViewBrowserActivity extends Activity implements PopupMenu.OnMenu

StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
+ .permitDiskReads()
+ .permitUnbufferedIo()
.penaltyLog()
.penaltyDeath()
.build());
--
2.34.1

0 comments on commit d476c89

Please sign in to comment.