Skip to content

Commit 5036a47

Browse files
authored
fix: ANR watcher wont crash on sec excep (#1962)
1 parent 7a5e470 commit 5036a47

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
## Unreleased
44

5-
* Fix: Sentry Timber integration does not submit msg.formatted breadcrumbs (#)
5+
* Fix: Sentry Timber integration does not submit msg.formatted breadcrumbs (#1957)
6+
* Fix: ANR WatchDog won't crash on SecurityException ([#1962](https://github.com/getsentry/sentry-java/pull/1962))
7+
68

79
## 5.7.0
810

sentry-android-core/src/main/java/io/sentry/android/core/ANRWatchDog.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,15 @@ public void run() {
7777
try {
7878
Thread.sleep(interval);
7979
} catch (InterruptedException e) {
80-
Thread.currentThread().interrupt();
80+
try {
81+
Thread.currentThread().interrupt();
82+
} catch (SecurityException ignored) {
83+
logger.log(
84+
SentryLevel.WARNING,
85+
"Failed to interrupt due to SecurityException: %s",
86+
e.getMessage());
87+
return;
88+
}
8189
logger.log(SentryLevel.WARNING, "Interrupted: %s", e.getMessage());
8290
return;
8391
}

0 commit comments

Comments
 (0)