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

Commit 8294f825 authored by Filip Gruszczynski's avatar Filip Gruszczynski Committed by Android (Google) Code Review
Browse files

Merge "Put PIP windows above transition animations."

parents c0309868 114d5ca7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -548,6 +548,10 @@ public class ActivityManager {
        public static boolean canReceiveKeys(int stackId) {
            return stackId != PINNED_STACK_ID;
        }

        public static boolean isAlwaysOnTop(int stackId) {
            return stackId == PINNED_STACK_ID;
        }
    }

    /**
+2 −3
Original line number Diff line number Diff line
@@ -538,9 +538,8 @@ final class ActivityStack {

        if (addIndex > 0) {
            final ActivityStack topStack = mStacks.get(addIndex - 1);
            if (topStack.mStackId == PINNED_STACK_ID && topStack != this) {
                // The pinned stack is always the top most stack (always-on-top).
                // So, stack is moved just below the pinned stack.
            if (StackId.isAlwaysOnTop(topStack.mStackId) && topStack != this) {
                // If the top stack is always on top, we move this stack just below it.
                addIndex--;
            }
        }
+2 −2
Original line number Diff line number Diff line
@@ -237,8 +237,8 @@ class DisplayContent {
    }

    void moveStack(TaskStack stack, boolean toTop) {
        if (stack.mStackId == PINNED_STACK_ID && !toTop) {
            // Pinned stack is always-on-top silly...
        if (StackId.isAlwaysOnTop(stack.mStackId) && !toTop) {
            // This stack is always-on-top silly...
            Slog.w(TAG, "Ignoring move of always-on-top stack=" + stack + " to bottom");
            return;
        }
+27 −8
Original line number Diff line number Diff line
@@ -58,6 +58,8 @@ import android.Manifest;
import android.animation.ValueAnimator;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.app.ActivityManager.StackId;
import android.app.ActivityManagerNative;
import android.app.AppOpsManager;
import android.app.IActivityManager;
@@ -8652,14 +8654,7 @@ public class WindowManagerService extends IWindowManager.Stub
            } else if (wtoken != null) {
                winAnimator.mAnimLayer =
                        w.mLayer + wtoken.mAppAnimator.animLayerAdjustment;
                if (wtoken.mWillReplaceWindow && wtoken.mReplacingWindow != w
                        && wtoken.mAnimateReplacingWindow) {
                    // We know that we will be animating a relaunching window in the near future,
                    // which will receive a z-order increase. We want the replaced window to
                    // immediately receive the same treatment, e.g. to be above the dock divider.
                    w.mLayer += TYPE_LAYER_OFFSET;
                    winAnimator.mAnimLayer += TYPE_LAYER_OFFSET;
                }
                forceHigherLayerIfNeeded(w, winAnimator, wtoken);
            } else {
                winAnimator.mAnimLayer = w.mLayer;
            }
@@ -8696,6 +8691,30 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    private void forceHigherLayerIfNeeded(WindowState w, WindowStateAnimator winAnimator,
            AppWindowToken wtoken) {
        boolean force = false;
        if (wtoken.mWillReplaceWindow && wtoken.mReplacingWindow != w
                && wtoken.mAnimateReplacingWindow) {
            // We know that we will be animating a relaunching window in the near future,
            // which will receive a z-order increase. We want the replaced window to
            // immediately receive the same treatment, e.g. to be above the dock divider.
            force = true;
        }
        if (!force) {
            final TaskStack stack = w.getStack();
            if (stack != null && StackId.isAlwaysOnTop(stack.mStackId)) {
                // If the window's stack is always on top, we want to make it above other windows
                // also when these windows are animating.
                force = true;
            }
        }
        if (force) {
            w.mLayer += TYPE_LAYER_OFFSET;
            winAnimator.mAnimLayer += TYPE_LAYER_OFFSET;
        }
    }

    void makeWindowFreezingScreenIfNeededLocked(WindowState w) {
        // If the screen is currently frozen or off, then keep
        // it frozen/off until this window draws at its new