App gets killed when Util::forcedExit() is called — how to handle this properly on Android?

I’m working on the Android build and I noticed that whenever Util::forcedExit() is called (for example when an internal error occurs), the whole app process is killed immediately.

This makes the app close completely and restart from scratch when reopened, which causes bad user experience.

I understand that Util::forcedExit is used for cleanup and to handle fatal errors,
but is there a better way to deal with these situations without killing the Android process?

It’s similar problem: App gets killed when Util::forcedExit() is called — how to handle this properly on Android? · Issue #13134 · CollaboraOnline/online · GitHub

For example:

Is there any existing or planned mechanism like a “soft” exit or controlled recovery?

Would it be possible to reset or reload the LibreOffice core instead of terminating the process?

Or is process termination currently required for stability reasons?

I’d like to know the recommended approach to fix or improve this behavior on Android,
so the app can recover gracefully instead of being killed.

Thanks! :folded_hands:

Hii @TanhXHND Thanks for the detailed report and sorry for late reply :slight_smile: /me i was on vacation…

I see you already solved the issue by some workaround App gets killed when Util::forcedExit() is called — how to handle this properly on Android? · Issue #13134 · CollaboraOnline/online · GitHub

I really appreciate your effort here

Thanks
Darshan