summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipDesktopState.java3
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/pip/PipDesktopStateTest.java19
2 files changed, 19 insertions, 3 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipDesktopState.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipDesktopState.java
index 453ca167557a..1128fb2259b2 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipDesktopState.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/PipDesktopState.java
@@ -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);
}
/**
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/pip/PipDesktopStateTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/pip/PipDesktopStateTest.java
index 4cdb1e5b5d10..25dbc64f83de 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/pip/PipDesktopStateTest.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/common/pip/PipDesktopStateTest.java
@@ -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,12 +120,28 @@ 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);
setDisplayWindowingMode(WINDOWING_MODE_FREEFORM);