tor-browser

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

commit e81a02b99aae84128329ba94f829efda821fa642
parent 04cd091917a368dbb9a722d9d1bbc5568f536c19
Author: Matthew Tighe <matthewdtighe@gmail.com>
Date:   Mon,  8 Dec 2025 17:05:50 +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