Fix VirtualDeviceManagerServiceTest failure
Test: m VirtualDeviceManagerServiceTest
Bug: 308771440
Change-Id: I537f489de6b3e4ec15380984b1a4381fe08fea78
diff --git a/services/tests/servicestests/src/com/android/server/companion/virtual/VirtualDeviceManagerServiceTest.java b/services/tests/servicestests/src/com/android/server/companion/virtual/VirtualDeviceManagerServiceTest.java
index 461d637..2598a6b 100644
--- a/services/tests/servicestests/src/com/android/server/companion/virtual/VirtualDeviceManagerServiceTest.java
+++ b/services/tests/servicestests/src/com/android/server/companion/virtual/VirtualDeviceManagerServiceTest.java
@@ -347,6 +347,8 @@
final DisplayInfo displayInfo = new DisplayInfo();
displayInfo.uniqueId = UNIQUE_ID;
doReturn(displayInfo).when(mDisplayManagerInternalMock).getDisplayInfo(anyInt());
+ doReturn(Display.INVALID_DISPLAY).when(mDisplayManagerInternalMock)
+ .getDisplayIdToMirror(anyInt());
LocalServices.removeServiceForTest(DisplayManagerInternal.class);
LocalServices.addService(DisplayManagerInternal.class, mDisplayManagerInternalMock);
@@ -1627,6 +1629,7 @@
@Test
public void openNonBlockedAppOnMirrorDisplay_flagDisabled_launchesActivity() {
+ mSetFlagsRule.disableFlags(Flags.FLAG_INTERACTIVE_SCREEN_MIRROR);
when(mDisplayManagerInternalMock.getDisplayIdToMirror(anyInt()))
.thenReturn(Display.DEFAULT_DISPLAY);
addVirtualDisplay(mDeviceImpl, DISPLAY_ID_1);
diff --git a/services/tests/servicestests/src/com/android/server/companion/virtual/VirtualDeviceRule.java b/services/tests/servicestests/src/com/android/server/companion/virtual/VirtualDeviceRule.java
index af633cc..dbd6c88 100644
--- a/services/tests/servicestests/src/com/android/server/companion/virtual/VirtualDeviceRule.java
+++ b/services/tests/servicestests/src/com/android/server/companion/virtual/VirtualDeviceRule.java
@@ -37,6 +37,7 @@
import android.os.Binder;
import android.testing.TestableContext;
import android.util.ArraySet;
+import android.view.Display;
import android.view.DisplayInfo;
import android.view.WindowManager;
@@ -137,6 +138,8 @@
final DisplayInfo displayInfo = new DisplayInfo();
displayInfo.uniqueId = "uniqueId";
doReturn(displayInfo).when(mDisplayManagerInternalMock).getDisplayInfo(anyInt());
+ doReturn(Display.INVALID_DISPLAY).when(mDisplayManagerInternalMock)
+ .getDisplayIdToMirror(anyInt());
LocalServices.removeServiceForTest(DisplayManagerInternal.class);
LocalServices.addService(DisplayManagerInternal.class, mDisplayManagerInternalMock);