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

Commit c3f56d76 authored by Sunny Goyal's avatar Sunny Goyal Committed by Android (Google) Code Review
Browse files

Merge "Fixing quickswitch window not properly aligned in split-screen" into sc-dev

parents 7de95d67 a1bed542
Loading
Loading
Loading
Loading
+20 −8
Original line number Diff line number Diff line
@@ -266,20 +266,32 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
        Gravity.apply(Gravity.CENTER, outWidth, outHeight, potentialTaskRect, outRect);
    }

    private PointF getTaskDimension(Context context, DeviceProfile dp) {
    private static PointF getTaskDimension(Context context, DeviceProfile dp) {
        PointF dimension = new PointF();
        getTaskDimension(context, dp, dimension);
        return dimension;
    }

    /**
     * Gets the dimension of the task in the current system state.
     */
    public static void getTaskDimension(Context context, DeviceProfile dp, PointF out) {
        if (dp.isMultiWindowMode) {
            WindowBounds bounds = SplitScreenBounds.INSTANCE.getSecondaryWindowBounds(context);
            dimension.x = bounds.availableSize.x;
            dimension.y = bounds.availableSize.y;
            if (TaskView.CLIP_STATUS_AND_NAV_BARS) {
                out.x = bounds.availableSize.x;
                out.y = bounds.availableSize.y;
            } else {
                out.x = bounds.availableSize.x + bounds.insets.left + bounds.insets.right;
                out.y = bounds.availableSize.y + bounds.insets.top + bounds.insets.bottom;
            }
        } else if (TaskView.CLIP_STATUS_AND_NAV_BARS) {
            dimension.x = dp.availableWidthPx;
            dimension.y = dp.availableHeightPx;
            out.x = dp.availableWidthPx;
            out.y = dp.availableHeightPx;
        } else {
            dimension.x = dp.widthPx;
            dimension.y = dp.heightPx;
            out.x = dp.widthPx;
            out.y = dp.heightPx;
        }
        return dimension;
    }

    /**
+2 −7
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static android.view.Surface.ROTATION_90;
import static com.android.launcher3.states.RotationHelper.ALLOW_ROTATION_PREFERENCE_KEY;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.launcher3.util.SettingsCache.ROTATION_SETTING_URI;
import static com.android.quickstep.BaseActivityInterface.getTaskDimension;

import static java.lang.annotation.RetentionPolicy.SOURCE;

@@ -49,7 +50,6 @@ import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.SettingsCache;
import com.android.launcher3.util.WindowBounds;
import com.android.quickstep.BaseActivityInterface;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.views.TaskView;
@@ -401,12 +401,7 @@ public class RecentsOrientedState implements
            fullHeight -= insets.top + insets.bottom;
        }

        if (dp.isMultiWindowMode) {
            WindowBounds bounds = SplitScreenBounds.INSTANCE.getSecondaryWindowBounds(mContext);
            outPivot.set(bounds.availableSize.x, bounds.availableSize.y);
        } else {
            outPivot.set(fullWidth, fullHeight);
        }
        getTaskDimension(mContext, dp, outPivot);
        float scale = Math.min(outPivot.x / taskView.width(), outPivot.y / taskView.height());
        // We also scale the preview as part of fullScreenParams, so account for that as well.
        if (fullWidth > 0) {