On some devices, swiping away the app in the task list (i.e. closing the Activity) completely kills the application, including background services that are supposed to keep running. It's down to this error in the logs:
chromium: [ERROR:android_webview/browser/aw_browser_terminator.cc:165] Renderer process (30478) crash detected (code -1).
chromium: [ERROR:android_webview/browser/aw_browser_terminator.cc:113] Render process (30478) kill (OOM or update) wasn't handed by all associated webviews, killing application.
I've traced this to the UMP library (3.2.0 and earlier) - even just calling consentInformation.requestConsentInfoUpdate is enough to cause this behaviour, and it disappears if you don't.
I assume what's happening is the consent form is being created (even if it isn't shown), and it has an associated
WebView that isn't being managed with the
Termination Handling API - so when the renderer crashes as part of the Activity being shut down, the
WebView is allowed to take down the entire application.
-----
This seems to happen in very specific circumstances - I can reproduce it every time, but only on an Android 13 MIUI device and not in an emulator. The Activity also needs to be visually updating - I have a custom view that's animating, and swiping away the Activity while that's happening causes this chain of events. Stopping the animation and waiting a moment means it doesn't happen - I assume this relates to whether a render process exists to crash in the first place.
I don't have a workaround for this (besides just not using UMP) because we have no access to that internal WebView and its termination handling. It deliberately destroys the whole application (as it says in its error log and the documentation I linked) unless that situation is handled - and it seems like it should be, the UMP library shouldn't be able to potentially take down an app that uses it like this. There are situations (like with services) where the application expects to survive an Activity's render process being killed - which is the case when the UMP calls are removed, and everything works fine.
I hope that's enough info to point you in the right direction - thanks!