public static int startActivity(Intent intent, int userId) {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
intent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT | Intent.FLAG_ACTIVITY_NEW_TASK);
ActivityOptions options = ActivityOptions.makeBasic().setLaunchDisplayId(65);
return (int) Cmd.INSTANCE().exec(
CmdConstants.CMD_START_ACTIVITY,
intent,
options.toBundle(),
userId
);
} else {
return (int) Cmd.INSTANCE().exec(
CmdConstants.CMD_START_ACTIVITY,
intent,
null,
userId
);
}
}
I changed startActivity in opensdk/HackApi.java to test setLaunchDisplayId working.
But application always starts in main display, not secondary display.
In the developer options, you can enable the 'simulate secondary display' option and obtain the displayId to test this code.