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

Commit da230cf5 authored by Jeremy Sim's avatar Jeremy Sim
Browse files

Request split launches using a new enum, snapPosition, rather than a float splitRatio

Split ratios are now stored as an int enum rather than float values. Previously, split ratios were stored as floats, which needed to be recalculated frequently and differed depending on device screen size. Now Shell to store and launch split screen setups using an enum rather than floats.

Bug: 274835596
Bug: 182839788
Test: Existing tests still pass
Change-Id: Iebb8d3c7e8f9d597a59b677e48072300ddea458f
parent 02b3cc56
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -50,9 +50,9 @@ import static com.android.launcher3.testing.shared.TestProtocol.QUICK_SWITCH_STA
import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN;
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.launcher3.util.SplitConfigurationOptions.DEFAULT_SPLIT_RATIO;
import static com.android.quickstep.util.SplitAnimationTimings.TABLET_HOME_TO_SPLIT;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_HOME_KEY;
import static com.android.wm.shell.common.split.SplitScreenConstants.SNAP_TO_50_50;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -1260,10 +1260,8 @@ public class QuickstepLauncher extends Launcher {
                /* callback= */ success -> mSplitSelectStateController.resetState(),
                /* freezeTaskList= */ true,
                groupTask.mSplitBounds == null
                        ? DEFAULT_SPLIT_RATIO
                        : groupTask.mSplitBounds.appsStackedVertically
                                ? groupTask.mSplitBounds.topTaskPercent
                                : groupTask.mSplitBounds.leftTaskPercent);
                        ? SNAP_TO_50_50
                        : groupTask.mSplitBounds.snapPosition);
    }

    /**
+2 −11
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.quickstep;

import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.quickstep.util.SplitScreenUtils.convertShellSplitBoundsToLauncher;
import static com.android.quickstep.views.DesktopTaskView.DESKTOP_MODE_SUPPORTED;
import static com.android.wm.shell.util.GroupedRecentTaskInfo.TYPE_FREEFORM;

@@ -39,7 +40,6 @@ import com.android.quickstep.util.GroupTask;
import com.android.systemui.shared.recents.model.Task;
import com.android.wm.shell.recents.IRecentTasksListener;
import com.android.wm.shell.util.GroupedRecentTaskInfo;
import com.android.wm.shell.util.SplitBounds;

import java.io.PrintWriter;
import java.util.ArrayList;
@@ -293,7 +293,7 @@ public class RecentTasksList {
                task2.setLastSnapshotData(taskInfo2);
            }
            final SplitConfigurationOptions.SplitBounds launcherSplitBounds =
                    convertSplitBounds(rawTask.getSplitBounds());
                    convertShellSplitBoundsToLauncher(rawTask.getSplitBounds());
            allTasks.add(new GroupTask(task1, task2, launcherSplitBounds));
        }

@@ -313,15 +313,6 @@ public class RecentTasksList {
        return new DesktopTask(tasks);
    }

    private SplitConfigurationOptions.SplitBounds convertSplitBounds(
            SplitBounds shellSplitBounds) {
        return shellSplitBounds == null ?
                null :
                new SplitConfigurationOptions.SplitBounds(
                        shellSplitBounds.leftTopBounds, shellSplitBounds.rightBottomBounds,
                        shellSplitBounds.leftTopTaskId, shellSplitBounds.rightBottomTaskId);
    }

    private ArrayList<GroupTask> copyOf(ArrayList<GroupTask> tasks) {
        ArrayList<GroupTask> newTasks = new ArrayList<>();
        for (int i = 0; i < tasks.size(); i++) {
+2 −1
Original line number Diff line number Diff line
@@ -138,7 +138,8 @@ public class RecentsAnimationCallbacks implements
                nonAppTargets = new RemoteAnimationTarget[0];
            }
            final RecentsAnimationTargets targets = new RecentsAnimationTargets(appTargets,
                    wallpaperTargets, nonAppTargets, homeContentInsets, minimizedHomeBounds);
                    wallpaperTargets, nonAppTargets, homeContentInsets, minimizedHomeBounds,
                    extras);

            Utilities.postAsyncCallback(MAIN_EXECUTOR.getHandler(), () -> {
                ActiveGestureLog.INSTANCE.addLog(
+3 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.view.RemoteAnimationTarget.MODE_CLOSING;

import android.app.WindowConfiguration;
import android.graphics.Rect;
import android.os.Bundle;
import android.view.RemoteAnimationTarget;

import com.android.quickstep.views.DesktopTaskView;
@@ -35,8 +36,8 @@ public class RecentsAnimationTargets extends RemoteAnimationTargets {

    public RecentsAnimationTargets(RemoteAnimationTarget[] apps,
            RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps,
            Rect homeContentInsets, Rect minimizedHomeBounds) {
        super(apps, wallpapers, nonApps, MODE_CLOSING);
            Rect homeContentInsets, Rect minimizedHomeBounds, Bundle extras) {
        super(apps, wallpapers, nonApps, MODE_CLOSING, extras);
        this.homeContentInsets = homeContentInsets;
        this.minimizedHomeBounds = minimizedHomeBounds;
    }
+10 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR;

import android.os.Bundle;
import android.view.RemoteAnimationTarget;

import java.util.ArrayList;
@@ -35,6 +36,7 @@ public class RemoteAnimationTargets {
    public final RemoteAnimationTarget[] apps;
    public final RemoteAnimationTarget[] wallpapers;
    public final RemoteAnimationTarget[] nonApps;
    public final Bundle extras;
    public final int targetMode;
    public final boolean hasRecents;

@@ -42,7 +44,7 @@ public class RemoteAnimationTargets {

    public RemoteAnimationTargets(RemoteAnimationTarget[] apps,
            RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps,
            int targetMode) {
            int targetMode, Bundle extras) {
        ArrayList<RemoteAnimationTarget> filteredApps = new ArrayList<>();
        boolean hasRecents = false;
        if (apps != null) {
@@ -61,6 +63,13 @@ public class RemoteAnimationTargets {
        this.targetMode = targetMode;
        this.hasRecents = hasRecents;
        this.nonApps = nonApps;
        this.extras = extras;
    }

    public RemoteAnimationTargets(RemoteAnimationTarget[] apps,
            RemoteAnimationTarget[] wallpapers, RemoteAnimationTarget[] nonApps,
            int targetMode) {
        this(apps, wallpapers, nonApps, targetMode, new Bundle());
    }

    public RemoteAnimationTarget findTask(int taskId) {
Loading