MIUI 11 preventing Activities (of other apps) being launched from foreground service?

Viewed 312

In some recent MIUI 11 update, it seems no longer possible to launch an Activity (at least, of another app) from a System Alert Window (SAW) running in a Foreground Service. I can confirm on my MIUI 11.0.5 device (not sure about earlier versions of MIUI 11) and from reports in the wild. This was all working fine a couple of months ago.

I've tested using (with and without the flag):

Intent intent = viewContext.getPackageManager().getLaunchIntentForPackage(otherPackageName);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // doesn't make a difference
viewContext.startActivity(intent)

called from a OnClickListener on the main View of the SAW.

Logcat shows that the system is getting the intent:

I/Timeline: Timeline: Activity_launch_request time:6329289 intent:Intent...

But nothing actually happens. I noticed calls to a ContentProvider on the other app, work as expected. I even tried starting the activity from within that ContentProvider, but that also did not work.

Perhaps, more generally, the issue is starting Activities (of other apps) from non-Activity Contexts.

Note: although it seems like the same issue as here, the accepted workaround does not apply in this case. Both apps have "Display pop-up windows while running in the background" permission enabled.

Any ideas?

0 Answers
Related