I have a following setup Android Device connected to 2 physical Displays
Display 21442613134359552 (HWC display 0): port=0 pnpId=XXX displayName="XXXMaster"
Display 21442613134359553 (HWC display 1): port=1 pnpId=XXX displayName="XXXMaster"
I'm trying to start the screen projection on the secondary display
// Getting Media Projection and Display Managers.
MediaProjectionManager mpm =
(MediaProjectionManager) activity.getSystemService(Context.MEDIA_PROJECTION_SERVICE);
DisplayManager dm =
(DisplayManager) activity.getSystemService(Context.DISPLAY_SERVICE);
// Adding an option to start activity on the Scondary Display.
ActivityOptions options = ActivityOptions.makeBasic();
options.setLaunchDisplayId(dm.getDisplays()[1].getDisplayId());
startActivityForResult(
mpm.createScreenCaptureIntent(), RESULT_OK, options.toBundle()
);
when I am running the code above, the system is popping up a message
App does not support launch on the secondary displays
the application which I am building has system-app privileges, but still, that does not improve the situation.
Questions
Is it possible to project secondary display if the app is running as a system application
Is it possible to project secondary display if the app is running as a NON-system application
Is it possible to specify display id while creating virtual display
MediaProjection.createVirtualDisplay