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

Commit 95d37ced authored by Tony Huang's avatar Tony Huang
Browse files

Fix pip or bubbles is under split divider

In stage split, it always set the divider layer to top and it would
Cover some layer it should not cover such as pip or bubbles.

In legacy split, this ordering is handled by TDA but it cannot apply
on stage split because it directly use WindowlessWindowManager without
shell root.

Fix it by simplify the layer ordering. Make divider layer as a fixed
value. Normal task layer should always lower than it and always on top
tasks layer count start from it so we can ensure always on top tasks
higher than the divider.

Also move some constants layer value to WindowManagerPolicyConstants
for managerment and accessed by both wm-core and wm-shell.

Fix: 194359996
Test: open a pip app and active stage split then drap the pip to
      divider.
Test: Pass existing tests.
Change-Id: I6e4002435be350872aec5fa154849ed6e9561ce0
parent 90f055a0
Loading
Loading
Loading
Loading
+37 −0
Original line number Diff line number Diff line
@@ -209,4 +209,41 @@ public interface WindowManagerPolicyConstants {
                return Integer.toString(why);
        }
    }

    /**
     * How much to multiply the policy's type layer, to reserve room
     * for multiple windows of the same type and Z-ordering adjustment
     * with TYPE_LAYER_OFFSET.
     */
    int TYPE_LAYER_MULTIPLIER = 10000;

    /**
     * Offset from TYPE_LAYER_MULTIPLIER for moving a group of windows above
     * or below others in the same layer.
     */
    int TYPE_LAYER_OFFSET = 1000;

    /**
     * How much to increment the layer for each window, to reserve room
     * for effect surfaces between them.
     */
    int WINDOW_LAYER_MULTIPLIER = 5;

    /**
     * Animation thumbnail is as far as possible below the window above
     * the thumbnail (or in other words as far as possible above the window
     * below it).
     */
    int LAYER_OFFSET_THUMBNAIL = WINDOW_LAYER_MULTIPLIER - 1;

    int SPLIT_DIVIDER_LAYER = TYPE_LAYER_MULTIPLIER * 3;
    int WATERMARK_LAYER = TYPE_LAYER_MULTIPLIER * 100;
    int STRICT_MODE_LAYER = TYPE_LAYER_MULTIPLIER * 101;
    int WINDOW_FREEZE_LAYER = TYPE_LAYER_MULTIPLIER * 200;

    /**
     * Layers for screen rotation animation. We put these layers above
     * WINDOW_FREEZE_LAYER so that screen freeze will cover all windows.
     */
    int SCREEN_FREEZE_LAYER_BASE = WINDOW_FREEZE_LAYER + TYPE_LAYER_MULTIPLIER;
}
+2 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ 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.SplitLayout.SPLIT_POSITION_BOTTOM_OR_RIGHT;
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_TOP_OR_LEFT;
@@ -181,7 +182,7 @@ class AppPair implements ShellTaskOrganizer.TaskListener, SplitLayout.SplitLayou

        // TODO: Is there more we need to do here?
        mSyncQueue.runInSync(t -> {
            t.setLayer(dividerLeash, Integer.MAX_VALUE)
            t.setLayer(dividerLeash, SPLIT_DIVIDER_LAYER)
                    .setPosition(mTaskLeash1, mTaskInfo1.positionInParent.x,
                            mTaskInfo1.positionInParent.y)
                    .setPosition(mTaskLeash2, mTaskInfo2.positionInParent.x,
+2 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ 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;
@@ -365,7 +366,7 @@ public final class SplitLayout {
        if (dividerLeash != null) {
            t.setPosition(dividerLeash, mDividerBounds.left, mDividerBounds.top);
            // Resets layer of divider bar to make sure it is always on top.
            t.setLayer(dividerLeash, Integer.MAX_VALUE);
            t.setLayer(dividerLeash, SPLIT_DIVIDER_LAYER);
        }
        t.setPosition(leash1, mBounds1.left, mBounds1.top)
                .setWindowCrop(leash1, mBounds1.width(), mBounds1.height());
+3 −3
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT;
import static android.view.WindowManager.transitTypeToString;
import static android.view.WindowManagerPolicyConstants.SPLIT_DIVIDER_LAYER;

import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__APP_DOES_NOT_SUPPORT_MULTIWINDOW;
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__APP_FINISHED;
@@ -88,7 +89,6 @@ import com.android.wm.shell.common.SyncTransactionQueue;
import com.android.wm.shell.common.TransactionPool;
import com.android.wm.shell.common.split.SplitLayout;
import com.android.wm.shell.common.split.SplitLayout.SplitPosition;
import com.android.wm.shell.common.split.SplitWindowManager;
import com.android.wm.shell.protolog.ShellProtoLogGroup;
import com.android.wm.shell.transition.Transitions;

@@ -696,7 +696,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,

        if (mDividerVisible) {
            t.show(dividerLeash)
                    .setLayer(dividerLeash, Integer.MAX_VALUE)
                    .setLayer(dividerLeash, SPLIT_DIVIDER_LAYER)
                    .setPosition(dividerLeash,
                            mSplitLayout.getDividerBounds().left,
                            mSplitLayout.getDividerBounds().top);
@@ -1133,7 +1133,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        // Be default, make it visible. The remote animator can adjust alpha if it plans to animate.
        if (show) {
            t.setAlpha(leash, 1.f);
            t.setLayer(leash, Integer.MAX_VALUE);
            t.setLayer(leash, SPLIT_DIVIDER_LAYER);
            t.setPosition(leash, bounds.left, bounds.top);
            t.show(leash);
        }
+1 −13
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.wm.shell.transition;
import static android.hardware.HardwareBuffer.RGBA_8888;
import static android.hardware.HardwareBuffer.USAGE_PROTECTED_CONTENT;
import static android.util.RotationUtils.deltaRotation;
import static android.view.WindowManagerPolicyConstants.SCREEN_FREEZE_LAYER_BASE;

import static com.android.wm.shell.transition.DefaultTransitionHandler.startSurfaceAnimation;
import static com.android.wm.shell.transition.Transitions.TAG;
@@ -81,19 +82,6 @@ import java.util.Arrays;
 * </ul>
 */
class ScreenRotationAnimation {

    /** How much to multiply the policy's type layer, to reserve room
     * for multiple windows of the same type and Z-ordering adjustment
     * with TYPE_LAYER_OFFSET. */
    static final int TYPE_LAYER_MULTIPLIER = 10000;
    static final int WINDOW_FREEZE_LAYER = TYPE_LAYER_MULTIPLIER * 200;

    /*
     * Layers for screen rotation animation. We put these layers above
     * WINDOW_FREEZE_LAYER so that screen freeze will cover all windows.
     */
    private static final int SCREEN_FREEZE_LAYER_BASE = WINDOW_FREEZE_LAYER + TYPE_LAYER_MULTIPLIER;

    static final int MAX_ANIMATION_DURATION = 10 * 1000;

    private final Context mContext;
Loading