Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5650fa8e authored by Mady Mellor's avatar Mady Mellor
Browse files

Fix an issue where the divider bar wasn't part of the hitRect for split

This doesn't result in an issue with existing code but with some changes
in how the animation works, this will become an issue.

e.g. you can get a null target when it should be non-null which changes
whether the animation is a switch between targets vs a new drag into a
target.

Test: manual - with new animation code, put two apps in split and then
               drag a new one into split and move it between containers,
               the animation should look like a switch (color changes
               seamlessly rather than a jump to transparent).
Bug: 207011867
Change-Id: I6d9c892654cbd57742bdf3268a8ab343f0fd3d3b
parent cb2fb682
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -62,6 +62,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.annotation.VisibleForTesting;


import com.android.internal.logging.InstanceId;
import com.android.internal.logging.InstanceId;
import com.android.wm.shell.R;
import com.android.wm.shell.common.DisplayLayout;
import com.android.wm.shell.common.DisplayLayout;
import com.android.wm.shell.common.split.SplitScreenConstants.SplitPosition;
import com.android.wm.shell.common.split.SplitScreenConstants.SplitPosition;
import com.android.wm.shell.splitscreen.SplitScreenController;
import com.android.wm.shell.splitscreen.SplitScreenController;
@@ -132,6 +133,8 @@ public class DragAndDropPolicy {
        final Rect fullscreenHitRegion = new Rect(displayRegion);
        final Rect fullscreenHitRegion = new Rect(displayRegion);
        final boolean inLandscape = mSession.displayLayout.isLandscape();
        final boolean inLandscape = mSession.displayLayout.isLandscape();
        final boolean inSplitScreen = mSplitScreen != null && mSplitScreen.isSplitScreenVisible();
        final boolean inSplitScreen = mSplitScreen != null && mSplitScreen.isSplitScreenVisible();
        final float dividerWidth = mContext.getResources().getDimensionPixelSize(
                R.dimen.split_divider_bar_width);
        // We allow splitting if we are already in split-screen or the running task is a standard
        // We allow splitting if we are already in split-screen or the running task is a standard
        // task in fullscreen mode.
        // task in fullscreen mode.
        final boolean allowSplit = inSplitScreen
        final boolean allowSplit = inSplitScreen
@@ -153,8 +156,11 @@ public class DragAndDropPolicy {


                // If we have existing split regions use those bounds, otherwise split it 50/50
                // If we have existing split regions use those bounds, otherwise split it 50/50
                if (inSplitScreen) {
                if (inSplitScreen) {
                    // Add the divider bounds to each side since that counts for the hit region.
                    leftHitRegion.set(topOrLeftBounds);
                    leftHitRegion.set(topOrLeftBounds);
                    leftHitRegion.right += dividerWidth / 2;
                    rightHitRegion.set(bottomOrRightBounds);
                    rightHitRegion.set(bottomOrRightBounds);
                    rightHitRegion.left -= dividerWidth / 2;
                } else {
                } else {
                    displayRegion.splitVertically(leftHitRegion, rightHitRegion);
                    displayRegion.splitVertically(leftHitRegion, rightHitRegion);
                }
                }
@@ -170,8 +176,11 @@ public class DragAndDropPolicy {


                // If we have existing split regions use those bounds, otherwise split it 50/50
                // If we have existing split regions use those bounds, otherwise split it 50/50
                if (inSplitScreen) {
                if (inSplitScreen) {
                    // Add the divider bounds to each side since that counts for the hit region.
                    topHitRegion.set(topOrLeftBounds);
                    topHitRegion.set(topOrLeftBounds);
                    topHitRegion.bottom += dividerWidth / 2;
                    bottomHitRegion.set(bottomOrRightBounds);
                    bottomHitRegion.set(bottomOrRightBounds);
                    bottomHitRegion.top -= dividerWidth / 2;
                } else {
                } else {
                    displayRegion.splitHorizontally(topHitRegion, bottomHitRegion);
                    displayRegion.splitHorizontally(topHitRegion, bottomHitRegion);
                }
                }