Search code examples
androidframeworksandroid-serviceandroid-sourcesplit-screen

Disabling SplitScreen mode in Nougat


How to disable the SplitScreen mode in Android 7.1.1 without disabling the MultiWindow mode?

I am using Freeform Window Mode to open multiple activities. In landscape orientation of device when an activitiy is dragged to the left or right edge of the screen the activity gets docked and the StackDivider splits the screen. Disabling MultiWindow mode eventually disables Freeform Window mode. So is there any way to disable the SplitScreen mode only (without disabling MultiWindow mode) by editing the Android source code?


Solution

  • In freeform mode, when an application or window is moved left or right corner of the screen by dragging its DecorCaptionView a dim layer is generated either at left or right depending on the position of window and it get docked to the current dim side on MOtionEvent.ACTION_UP event.

    The MotionEvent actions on DecorCaptionView is handled by frameworks/base/services/core/java/com/android/server/wm/TaskPositioner.java and moveTaskToDockedStack() method in ActivityManagerService is invoked whenever a window gets docked. The updateDimLayerVisibility() method in TaskPositioner.java is responsible for the creation of dim layer. So the SplitScreen mode can be disabled by commenting out above mentioned two method calling lines in TaskPositioner.java.