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

Commit c51d29df authored by Kazuki Takise's avatar Kazuki Takise
Browse files

Fix forceHiddenForPip for freeform mode

The windowing mode set to exit PiP isn't necessarily UNDEFINED, but
could be FREEFORM, FULLSCREEN, etc depending on the Shell's
policies.

Bug: 265106229
Test: Manually dismiss PiP and confirm it's not moved to front.
Change-Id: I9a6dd4d967f4e70bd56f38f16763a5ea37cee4cf
parent cddf3430
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ package com.android.server.wm;

import static android.Manifest.permission.START_TASKS_FROM_RECENTS;
import static android.app.ActivityManager.isStartResultSuccessful;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOW_CONFIG_BOUNDS;
import static android.view.Display.DEFAULT_DISPLAY;
import static android.window.TaskFragmentOperation.OP_TYPE_CLEAR_ADJACENT_TASK_FRAGMENTS;
@@ -532,9 +532,9 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                // setWindowingMode call in force-hidden.
                boolean forceHiddenForPip = false;
                if (wc.asTask() != null && wc.inPinnedWindowingMode()
                        && entry.getValue().getWindowingMode() == WINDOWING_MODE_UNDEFINED) {
                    // We are in pip and going to undefined. Now search hierarchy ops to determine
                    // whether we are removing pip or expanding pip.
                        && entry.getValue().getWindowingMode() != WINDOWING_MODE_PINNED) {
                    // We are going out of pip. Now search hierarchy ops to determine whether we
                    // are removing pip or expanding pip.
                    for (int i = 0; i < hopSize; ++i) {
                        final WindowContainerTransaction.HierarchyOp hop = hops.get(i);
                        if (hop.getType() != HIERARCHY_OP_TYPE_REORDER) continue;
@@ -670,7 +670,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                        + " windowing mode during locked task mode.");
            }

            if (windowingMode == WindowConfiguration.WINDOWING_MODE_PINNED) {
            if (windowingMode == WINDOWING_MODE_PINNED) {
                // Do not directly put the container into PINNED mode as it may not support it or
                // the app may not want to enter it. Instead, send a signal to request PIP
                // mode to the app if they wish to support it below in #applyTaskChanges.
@@ -722,7 +722,7 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
            tr.mDisplayContent.mPinnedTaskController.setEnterPipBounds(enterPipBounds);
        }

        if (c.getWindowingMode() == WindowConfiguration.WINDOWING_MODE_PINNED
        if (c.getWindowingMode() == WINDOWING_MODE_PINNED
                && !tr.inPinnedWindowingMode()) {
            final ActivityRecord activity = tr.getTopNonFinishingActivity();
            if (activity != null) {