AndroidManifest.xml
<activity
android:name=".PermissionActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:excludeFromRecents="true"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
java文件
/**
* 仅UI进程初始化 restartIntent
*/
Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName());
if (intent!=null){
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
restartIntent = PendingIntent.getActivity(
getApplicationContext(), 1, intent, PendingIntent.FLAG_ONE_SHOT);
}