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

Commit b08353eb authored by Merissa Mitchell's avatar Merissa Mitchell Committed by Android (Google) Code Review
Browse files

Merge "[PiP on Desktop] Remove display windowing check in isPipInDesktopMode." into main

parents 89ffd1fd a7a1029c
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);