Xiaomi - “Start in background” - Permission off has bug that breaks Notification back stacks

This issue has been tracked since 2022-04-17.


This is a MIUI bug that affects any apps that displays Notifications. Specifically apps that want their notification to direct their users to a specific screen and then want to control the screen the user sees after they push the Android back button.

This issue happens if the “Display pop-up windows while running in the background” (older MIUI versions this is called “Start in background”) permission is "Deny"(default) for the app. This seems like a bug (unintended side effect) on this permission but regardless it is a background behavior app developers should be aware of and is something that should be callout on this site.


App developer creates a Notification with a PendingIntent that will open "ActivityA" and puts "ActivityB" on the back stack via the TaskStackBuilder API. The back stack is defined in their AndroidManifest.xml with android:parentActivityName and the meta-data tag with name="android.support.PARENT_ACTIVITY".

The bug here is if the user swipes away the app and taps on a notification. After the user presses the device's back button the app goes to the homescreen instead of following the app developer's intended back stack, which was "ActivityB". This bug does not happen on other Android devices so this is a MIUI issue. It isn't an Android AOSP issue.

Minimum Reproducible Example

I have created a simple example project that demonstrates this issue:


I have also report this bug on the official "Xiaomi Community" bug:

More Details About Repo
Owner Name urbandroid-team
Repo Name dont-kill-my-app
Full Name urbandroid-team/dont-kill-my-app
Language JavaScript
Created Date 2018-12-19
Updated Date 2022-12-08
Star Count 904
Watcher Count 82
Fork Count 681
Issue Count 212


Issue Title Created Date Updated Date