MIUI 10 doesn't let service start activity - Xiaomi Redmi Note : <p>My app has a service and an activity. From the service,  activity is called with following code:</p>

<pre><code>Intent intent = new Intent(getApplicationContext(), MainActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
</code></pre>

<p>even without the flags, normally the activity window is displayed with its correct layout.
However, on Xiaomi Redmi Note 4 with Android 7, activity layout is not displayed. I only see the following line on logcat:</p>

<blockquote>
  <p>I/Timeline: Timeline: Activity_launch_request time:281438674
  intent:Intent { flg=0x30000000 cmp=com.test.app/.MainActivity }</p>
</blockquote>

<p>I believe this is not an Android 7 (API 24) issue because on another device with Android 7, service can successfully start the activity.
I guess, MIUI is preventing the launch of the activity from service.</p>

<p>I tried changing how the activity was defined in the manifest. I also tried with several different flags.
All of my tests failed. I could not succeed in starting the activity. Worst issue is that there is no error/exception in the logs.</p>

<p>Any ideas on this please ?</p>
