Skip to content

ActivityOptions setLaunchDisplayId not working #29

@trickymagus

Description

@trickymagus
    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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions