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

Commit 64d76ce0 authored by Jerry Chang's avatar Jerry Chang Committed by Android (Google) Code Review
Browse files

Merge changes from topic "splitscreen_singletop" into tm-dev

* changes:
  Consolidate split screen rotation in shell transition
  Add a single-top root task for split screen
parents 5f5ab5a7 31838fb8
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -472,7 +472,8 @@ public class TaskInfo {
                && isFocused == that.isFocused
                && isVisible == that.isVisible
                && isSleeping == that.isSleeping
                && Objects.equals(mTopActivityLocusId, that.mTopActivityLocusId);
                && Objects.equals(mTopActivityLocusId, that.mTopActivityLocusId)
                && parentTaskId == that.parentTaskId;
    }

    /**
+0 −16
Original line number Diff line number Diff line
@@ -119,8 +119,6 @@ public final class ShellCommandHandlerImpl {
                return runRemoveFromSideStage(args, pw);
            case "setSideStagePosition":
                return runSetSideStagePosition(args, pw);
            case "setSideStageVisibility":
                return runSetSideStageVisibility(args, pw);
            case "help":
                return runHelp(pw);
            default:
@@ -186,18 +184,6 @@ public final class ShellCommandHandlerImpl {
        return true;
    }

    private boolean runSetSideStageVisibility(String[] args, PrintWriter pw) {
        if (args.length < 3) {
            // First arguments are "WMShell" and command name.
            pw.println("Error: side stage visibility should be provided as arguments");
            return false;
        }
        final Boolean visible = new Boolean(args[2]);

        mSplitScreenOptional.ifPresent(split -> split.setSideStageVisibility(visible));
        return true;
    }

    private boolean runHelp(PrintWriter pw) {
        pw.println("Window Manager Shell commands:");
        pw.println("  help");
@@ -215,8 +201,6 @@ public final class ShellCommandHandlerImpl {
        pw.println("    Enable/Disable outline on the side-stage.");
        pw.println("  setSideStagePosition <SideStagePosition>");
        pw.println("    Sets the position of the side-stage.");
        pw.println("  setSideStageVisibility <true/false>");
        pw.println("    Show/hide side-stage.");
        return true;
    }

+1 −2
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.wm.shell.apppairs;
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.view.WindowManagerPolicyConstants.SPLIT_DIVIDER_LAYER;

import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT;
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT;
@@ -83,7 +82,7 @@ class AppPair implements ShellTaskOrganizer.TaskListener, SplitLayout.SplitLayou
        public void onLeashReady(SurfaceControl leash) {
            mSyncQueue.runInSync(t -> t
                    .show(leash)
                    .setLayer(leash, SPLIT_DIVIDER_LAYER)
                    .setLayer(leash, Integer.MAX_VALUE)
                    .setPosition(leash,
                            mSplitLayout.getDividerBounds().left,
                            mSplitLayout.getDividerBounds().top));
+2 −3
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
import static android.view.WindowManagerPolicyConstants.SPLIT_DIVIDER_LAYER;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -162,7 +161,7 @@ public class SplitDecorManager extends WindowlessWindowManager {
            mBackgroundLeash = SurfaceUtils.makeColorLayer(mHostLeash,
                    RESIZING_BACKGROUND_SURFACE_NAME, mSurfaceSession);
            t.setColor(mBackgroundLeash, getResizingBackgroundColor(resizingTask))
                    .setLayer(mBackgroundLeash, SPLIT_DIVIDER_LAYER - 1);
                    .setLayer(mBackgroundLeash, Integer.MAX_VALUE - 1);
        }

        if (mIcon == null && resizingTask.topActivityInfo != null) {
@@ -175,7 +174,7 @@ public class SplitDecorManager extends WindowlessWindowManager {
            lp.width = mIcon.getIntrinsicWidth();
            lp.height = mIcon.getIntrinsicHeight();
            mViewHost.relayout(lp);
            t.setLayer(mIconLeash, SPLIT_DIVIDER_LAYER);
            t.setLayer(mIconLeash, Integer.MAX_VALUE);
        }
        t.setPosition(mIconLeash,
                newBounds.width() / 2 - mIcon.getIntrinsicWidth() / 2,
+11 −12
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import static android.view.WindowManager.DOCKED_INVALID;
import static android.view.WindowManager.DOCKED_LEFT;
import static android.view.WindowManager.DOCKED_RIGHT;
import static android.view.WindowManager.DOCKED_TOP;
import static android.view.WindowManagerPolicyConstants.SPLIT_DIVIDER_LAYER;

import static com.android.internal.policy.DividerSnapAlgorithm.SnapTarget.FLAG_DISMISS_END;
import static com.android.internal.policy.DividerSnapAlgorithm.SnapTarget.FLAG_DISMISS_START;
@@ -202,24 +201,24 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange

    /** Applies new configuration, returns {@code false} if there's no effect to the layout. */
    public boolean updateConfiguration(Configuration configuration) {
        // Always update configuration after orientation changed to make sure to render divider bar
        // with proper resources that matching screen orientation.
        final int orientation = configuration.orientation;
        if (mOrientation != orientation) {
            mContext = mContext.createConfigurationContext(configuration);
            mSplitWindowManager.setConfiguration(configuration);
            mOrientation = orientation;
        }

        // Update the split bounds when necessary. Besides root bounds changed, split bounds need to
        // be updated when the rotation changed to cover the case that users rotated the screen 180
        // degrees.
        // Make sure to render the divider bar with proper resources that matching the screen
        // orientation.
        final int rotation = configuration.windowConfiguration.getRotation();
        final Rect rootBounds = configuration.windowConfiguration.getBounds();
        final int orientation = configuration.orientation;

        if (mOrientation == orientation
                && rotation == mRotation
                && mRootBounds.equals(rootBounds)) {
        if (mRotation == rotation && mRootBounds.equals(rootBounds)) {
            return false;
        }

        mContext = mContext.createConfigurationContext(configuration);
        mSplitWindowManager.setConfiguration(configuration);
        mOrientation = orientation;
        mTempRect.set(mRootBounds);
        mRootBounds.set(rootBounds);
        mRotation = rotation;
@@ -493,7 +492,7 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
            mTempRect.set(getRefDividerBounds());
            t.setPosition(dividerLeash, mTempRect.left, mTempRect.top);
            // Resets layer of divider bar to make sure it is always on top.
            t.setLayer(dividerLeash, SPLIT_DIVIDER_LAYER);
            t.setLayer(dividerLeash, Integer.MAX_VALUE);
        }
        mTempRect.set(getRefBounds1());
        t.setPosition(leash1, mTempRect.left, mTempRect.top)
Loading