tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 8cbe7e15d29e0de1af3e735c3a1810fe9289deaa
parent 2dfc18af358ee04d70896f9e169e72c0d84d658f
Author: Matthew Tighe <matthewdtighe@gmail.com>
Date:   Wed, 10 Dec 2025 00:55:58 +0000

Bug 2003887 - silently fail when trying to start services while backgrounded r=android-reviewers,tcampbell

Differential Revision: https://phabricator.services.mozilla.com/D275022

Diffstat:
Mmobile/android/android-components/components/lib/crash/src/main/java/mozilla/components/lib/crash/CrashReporter.kt | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/mobile/android/android-components/components/lib/crash/src/main/java/mozilla/components/lib/crash/CrashReporter.kt b/mobile/android/android-components/components/lib/crash/src/main/java/mozilla/components/lib/crash/CrashReporter.kt @@ -4,6 +4,7 @@ package mozilla.components.lib.crash +import android.app.ForegroundServiceStartNotAllowedException import android.app.PendingIntent import android.content.Context import android.content.Intent @@ -397,6 +398,14 @@ class CrashReporter internal constructor( ) logger.warn("replaced throwable for crash that could not be serialized") } + } catch (e: IllegalStateException) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.S && + e is ForegroundServiceStartNotAllowedException + ) { + logger.warn("ignored failed service start while backgrounded") + } else { + throw e + } } @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) @@ -413,6 +422,14 @@ class CrashReporter internal constructor( ) logger.warn("replaced throwable for crash that could not be serialized") } + } catch (e: IllegalStateException) { + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.S && + e is ForegroundServiceStartNotAllowedException + ) { + logger.warn("ignored failed service start while backgrounded") + } else { + throw e + } } @VisibleForTesting