App with calculator freezes after some time

This is about an app that starts up with a calculator. I tested the app on a physical device with Android 12. All worked well but after the app had been in the background (for a few minutes?), it froze. Instead of the book selector, just a “calculator” title appeared on the top. I couldn’t do anything (not even open the navigation drawer) but had to restart the app. This happened a few times.