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

Commit a7a1029c authored by Merissa Mitchell's avatar Merissa Mitchell
Browse files

[PiP on Desktop] Remove display windowing check in isPipInDesktopMode.

We no longer need to check the windowing mode of the display in
PipDesktopState#isPipInDesktopMode. The isAnyDeskActive check is
sufficient to indicate whether the PiP window is in an active Desktop
session.

Bug: None
Test: atest PipDesktopStateTest
Test: Manually check that PiP window expands in freeform while in
Desktop session
Flag: com.android.window.flags.enable_desktop_windowing_pip

Change-Id: Ia7ee25f051616c8161d52c999f0f4a8f894731e9
parent 3eef4944
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -86,8 +86,7 @@ public class PipDesktopState {
            return false;
        }
        final int displayId = mPipDisplayLayoutState.getDisplayId();
        return mDesktopUserRepositoriesOptional.get().getCurrent().isAnyDeskActive(displayId)
                || isDisplayInFreeform();
        return mDesktopUserRepositoriesOptional.get().getCurrent().isAnyDeskActive(displayId);
    }

    /**
+18 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;

import static com.android.window.flags.Flags.FLAG_ENABLE_CONNECTED_DISPLAYS_PIP;
import static com.android.window.flags.Flags.FLAG_ENABLE_DESKTOP_WINDOWING_PIP;
import static com.android.wm.shell.Flags.FLAG_ENABLE_PIP2;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
@@ -119,11 +120,27 @@ public class PipDesktopStateTest {
    }

    @Test
    @EnableFlags(FLAG_ENABLE_CONNECTED_DISPLAYS_PIP)
    @EnableFlags({
            FLAG_ENABLE_CONNECTED_DISPLAYS_PIP, FLAG_ENABLE_PIP2
    })
    public void isConnectedDisplaysPipEnabled_returnsTrue() {
        assertTrue(mPipDesktopState.isConnectedDisplaysPipEnabled());
    }

    @Test
    public void isPipInDesktopMode_anyDeskActive_returnsTrue() {
        when(mMockDesktopRepository.isAnyDeskActive(DISPLAY_ID)).thenReturn(true);

        assertTrue(mPipDesktopState.isPipInDesktopMode());
    }

    @Test
    public void isPipInDesktopMode_noDeskActive_returnsFalse() {
        when(mMockDesktopRepository.isAnyDeskActive(DISPLAY_ID)).thenReturn(false);

        assertFalse(mPipDesktopState.isPipInDesktopMode());
    }

    @Test
    public void getOutPipWindowingMode_exitToDesktop_displayFreeform_returnsUndefined() {
        when(mMockDesktopRepository.isAnyDeskActive(DISPLAY_ID)).thenReturn(true);