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

Commit 19954f5f authored by Phill Hayers's avatar Phill Hayers Committed by Android (Google) Code Review
Browse files

Merge "Ensure that VIRTUAL_DISPLAY_FLAG_DEVICE_DISPLAY_GROUP doesn't cause NPEs"

parents aa7f951c edddc6be
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.