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

Commit edddc6be authored by Phill Hayers's avatar Phill Hayers
Browse files

Ensure that VIRTUAL_DISPLAY_FLAG_DEVICE_DISPLAY_GROUP doesn't cause NPEs

Test: atest WindoFocusTests against ag/20678587
Bug: 261822020
Change-Id: I6c97e441272658b0ab01f7832a12bccc1b392820
parent 4d625116
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -1414,6 +1414,7 @@ public final class DisplayManagerService extends SystemService {
        // LogicalDisplayMapper aware of the link between the new display and its associated virtual
        // device before triggering DISPLAY_DEVICE_EVENT_ADDED.
        if ((flags & VIRTUAL_DISPLAY_FLAG_DEVICE_DISPLAY_GROUP) != 0) {
            if (virtualDevice != null) {
                try {
                    final int virtualDeviceId = virtualDevice.getDeviceId();
                    mLogicalDisplayMapper.associateDisplayDeviceWithVirtualDevice(
@@ -1421,6 +1422,13 @@ public final class DisplayManagerService extends SystemService {
                } catch (RemoteException e) {
                    e.rethrowFromSystemServer();
                }
            } else {
                Slog.i(
                        TAG,
                        "Display created with VIRTUAL_DISPLAY_FLAG_DEVICE_DISPLAY_GROUP set, but no"
                            + " virtual device. The display will not be added to a device display"
                            + " group.");
            }
        }

        // DisplayDevice events are handled manually for Virtual Displays.