Android 10 — Pixel Launcher app pause
Pixel Launcher on Android 10 supported a new feature to pause apps from within the launcher for a day. This clears the app from the recent app history, mutes all notifications from the app for rest of the day. The app is automatically unpaused the next day. Meanwhile, any attempt to launch the app again throws this warning message with an option for users to unpause it explicitly.
So what goes on under the hood? Does pausing an app kill the process (if already alive)? Turns out, the process is not killed and kept alive. However, all notifications and ongoing toasts are stopped immediately upon pause and the launcher activity is not destroyed.
Unpausing the app instead of restarting and resuming the previously created activity, creates a new instance of the launcher activity with an empty savedInstanceState.
While this would work for most apps, the catch is that onDestroy of the app launcher activity is not invoked on the previous instance of the activity upon pause. Any necessary cleanup needs to be handled explicitly from the newly created activity instance after unpause.