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

Commit 98103468 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Scale screenWidth for split proportionally for thumbnail matrix

* Instead of passing in screenWidth to be that
of entire screen when using split, scale screenWidth
to that of only the amount that the given split app
is taking.
* Created TODO(b/254378592) to consolidate different
SplitBounds classes

Fixes: 250817893
Test: Checked phone/tablet swiping quickswitching
portrait and landscape

Change-Id: I5c3b2076110e358366284b2c794fd8df8a79f034
parent 126d1783
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -191,6 +191,7 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
        mStagePosition = mThumbnailPosition.equals(splitInfo.leftTopBounds) ?
                STAGE_POSITION_TOP_OR_LEFT :
                STAGE_POSITION_BOTTOM_OR_RIGHT;
        mPositionHelper.setSplitBounds(convertSplitBounds(mSplitBounds), mStagePosition);
    }

    /**
@@ -418,4 +419,15 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
        return Math.max(Math.abs(mTempPoint[0]), Math.abs(mTempPoint[1]));
    }

    /**
     * TODO(b/254378592): Remove this after consolidation of classes
     */
    public static com.android.wm.shell.util.SplitBounds convertSplitBounds(SplitBounds bounds) {
        return new com.android.wm.shell.util.SplitBounds(
                bounds.leftTopBounds,
                bounds.rightBottomBounds,
                bounds.leftTopTaskId,
                bounds.rightBottomTaskId
        );
    }
}
+16 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.util.RunnableList;
import com.android.launcher3.util.SplitConfigurationOptions;
import com.android.launcher3.util.SplitConfigurationOptions.SplitBounds;
import com.android.launcher3.util.TransformingTouchDelegate;
import com.android.quickstep.RecentsModel;
@@ -26,8 +27,10 @@ import com.android.quickstep.TaskIconCache;
import com.android.quickstep.TaskThumbnailCache;
import com.android.quickstep.util.CancellableTask;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.util.TaskViewSimulator;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.recents.utilities.PreviewPositionHelper;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;

import java.util.HashMap;
@@ -86,9 +89,19 @@ public class GroupedTaskView extends TaskView {
        mTaskIdContainer[1] = secondary.key.id;
        mTaskIdAttributeContainer[1] = new TaskIdAttributeContainer(secondary, mSnapshotView2,
                mIconView2, STAGE_POSITION_BOTTOM_OR_RIGHT);
        mTaskIdAttributeContainer[0].setStagePosition(STAGE_POSITION_TOP_OR_LEFT);
        mTaskIdAttributeContainer[0].setStagePosition(
                SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT);
        mSnapshotView2.bind(secondary);
        mSplitBoundsConfig = splitBoundsConfig;
        if (mSplitBoundsConfig == null) {
            return;
        }
        mSnapshotView.getPreviewPositionHelper().setSplitBounds(TaskViewSimulator
                        .convertSplitBounds(splitBoundsConfig),
                PreviewPositionHelper.STAGE_POSITION_TOP_OR_LEFT);
        mSnapshotView2.getPreviewPositionHelper().setSplitBounds(TaskViewSimulator
                        .convertSplitBounds(splitBoundsConfig),
                PreviewPositionHelper.STAGE_POSITION_BOTTOM_OR_RIGHT);
    }

    @Override
@@ -207,7 +220,8 @@ public class GroupedTaskView extends TaskView {
    @Override
    public void launchTask(@NonNull Consumer<Boolean> callback, boolean freezeTaskList) {
        getRecentsView().getSplitSelectController().launchTasks(mTask.key.id, mSecondaryTask.key.id,
                STAGE_POSITION_TOP_OR_LEFT, callback, freezeTaskList, getSplitRatio());
                SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT, callback, freezeTaskList,
                getSplitRatio());
    }

    @Override
+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ public final class SplitConfigurationOptions {
     * with the same name/functionality in wm.shell.util (which launcher3 cannot be built against)
     *
     * If you make changes here, consider making the same changes there
     * TODO(b/254378592): We really need to consolidate this
     */
    public static class SplitBounds {
        public final Rect leftTopBounds;