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

Commit 980bde3b authored by Jorge Gil's avatar Jorge Gil Committed by Android (Google) Code Review
Browse files

Merge "Desks: Use correct displayId for active desk look up" into main

parents de8749a8 097aaddc
Loading
Loading
Loading
Loading
+15 −12
Original line number Diff line number Diff line
@@ -427,7 +427,8 @@ public class DefaultMixedHandler implements MixedTransitionHandler,
                        new WindowContainerTransaction());
            }
            final MixedTransition mixed = createRecentsMixedTransition(
                    MixedTransition.TYPE_RECENTS_DURING_SPLIT, transition);
                    MixedTransition.TYPE_RECENTS_DURING_SPLIT, transition,
                    request.getTriggerTask().displayId);
            mixed.mLeftoversHandler = handler.first;
            mActiveTransitions.add(mixed);
            return handler.second;
@@ -475,13 +476,13 @@ public class DefaultMixedHandler implements MixedTransitionHandler,
                        displayId));
        if (mRecentsHandler != null) {
            if (mSplitHandler.isSplitScreenVisible()) {
                return this::setRecentsTransitionDuringSplit;
                return transition -> setRecentsTransitionDuringSplit(transition, displayId);
            } else if (mKeyguardHandler.isKeyguardShowing()
                    && !mKeyguardHandler.isKeyguardAnimating()) {
                return this::setRecentsTransitionDuringKeyguard;
                return transition -> setRecentsTransitionDuringKeyguard(transition, displayId);
            } else if (mDesktopTasksController != null
                    && mDesktopTasksController.isAnyDeskActive(displayId)) {
                return this::setRecentsTransitionDuringDesktop;
                return transition -> setRecentsTransitionDuringDesktop(transition, displayId);
            }
        }
        return null;
@@ -505,30 +506,32 @@ public class DefaultMixedHandler implements MixedTransitionHandler,
        }
    }

    private void setRecentsTransitionDuringSplit(IBinder transition) {
    private void setRecentsTransitionDuringSplit(IBinder transition, int displayId) {
        ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Got a recents request while "
                + "Split-Screen is foreground, so treat it as Mixed.");
        mActiveTransitions.add(createRecentsMixedTransition(
                MixedTransition.TYPE_RECENTS_DURING_SPLIT, transition));
                MixedTransition.TYPE_RECENTS_DURING_SPLIT, transition, displayId));
    }

    private void setRecentsTransitionDuringKeyguard(IBinder transition) {
    private void setRecentsTransitionDuringKeyguard(IBinder transition, int displayId) {
        ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Got a recents request while "
                + "keyguard is visible, so treat it as Mixed.");
        mActiveTransitions.add(createRecentsMixedTransition(
                MixedTransition.TYPE_RECENTS_DURING_KEYGUARD, transition));
                MixedTransition.TYPE_RECENTS_DURING_KEYGUARD, transition, displayId));
    }

    private void setRecentsTransitionDuringDesktop(IBinder transition) {
    private void setRecentsTransitionDuringDesktop(IBinder transition, int displayId) {
        ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Got a recents request while "
                + "desktop mode is active, so treat it as Mixed.");
        mActiveTransitions.add(createRecentsMixedTransition(
                MixedTransition.TYPE_RECENTS_DURING_DESKTOP, transition));
                MixedTransition.TYPE_RECENTS_DURING_DESKTOP, transition, displayId));
    }

    private MixedTransition createRecentsMixedTransition(int type, IBinder transition) {
    private MixedTransition createRecentsMixedTransition(int type, IBinder transition,
            int displayId) {
        return new RecentsMixedTransition(type, transition, mPlayer, this, mPipHandler,
                mSplitHandler, mKeyguardHandler, mRecentsHandler, mDesktopTasksController);
                mSplitHandler, mKeyguardHandler, mRecentsHandler, mDesktopTasksController,
                displayId);
    }

    static TransitionInfo subCopy(@NonNull TransitionInfo info,
+3 −3
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.wm.shell.transition;

import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_UNOCCLUDING;

import static com.android.wm.shell.shared.split.SplitScreenConstants.SPLIT_POSITION_UNDEFINED;
@@ -54,13 +53,14 @@ class RecentsMixedTransition extends DefaultMixedHandler.MixedTransition {
            MixedTransitionHandler mixedHandler, PipTransitionController pipHandler,
            StageCoordinator splitHandler, KeyguardTransitionHandler keyguardHandler,
            RecentsTransitionHandler recentsHandler,
            DesktopTasksController desktopTasksController) {
            DesktopTasksController desktopTasksController,
            int displayId) {
        super(type, transition, player, mixedHandler, pipHandler, splitHandler, keyguardHandler);
        mRecentsHandler = recentsHandler;
        mDesktopTasksController = desktopTasksController;
        mLeftoversHandler = mRecentsHandler;
        mActiveDeskIdOnStart = mType == TYPE_RECENTS_DURING_DESKTOP
                ? mDesktopTasksController.getActiveDeskId(DEFAULT_DISPLAY) : null;
                ? mDesktopTasksController.getActiveDeskId(displayId) : null;
    }

    @Override