android11/Q split screen implementation.
1. First confirm that split screen is supported.
调用boolean supportsSplitScreenMultiWindow =
ActivityTaskManager.supportsSplitScreenMultiWindow(mContext);
Check whether split screen is supported.
If it returns false, modify frameworks\base\core\res\res\values\config.xml
config_supportsSplitScreenMultiWindow为true
2. Split-screen call
mActivityTaskMgr.getService().setTaskWindowingModeSplitScreenPrimary(mLeftTask.id, false); mActivityTaskMgr.getService().resizeTask(mLeftTask.id,mSplitScreenRect,0);
可参考frameworks\base\packages\SystemUI\src\com\android\systemui\recents\OverviewProxyRecentsImpl.java
3. Exit split screen
mActivityTaskMgr.getService().setTaskWindowingMode(mLeftTask.id, WINDOWING_MODE_FULLSCREEN, false);
4. The dividing line in the middle
frameworks\base\packages\SystemUI\src\com\android\systemui\stackdivider
Divider.java added.
Encounter problems:
1. After calling the split-screen interface setTaskWindowingModeSplitScreenPrimary, and calling the split-screen interface again to exit the split-screen, the application appears a black screen. I hope that anyone who encounters this problem can explain it.
2. Please also ask, after entering the split screen, you can switch the application in the right window. Is there a way to replace the application in the left window?