Ensure that VIRTUAL_DISPLAY_FLAG_DEVICE_DISPLAY_GROUP doesn't cause NPEs
Test: atest WindoFocusTests against ag/20678587 Bug: 261822020 Change-Id: I6c97e441272658b0ab01f7832a12bccc1b392820
This commit is contained in:
@@ -1414,12 +1414,20 @@ 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) {
|
||||
try {
|
||||
final int virtualDeviceId = virtualDevice.getDeviceId();
|
||||
mLogicalDisplayMapper.associateDisplayDeviceWithVirtualDevice(
|
||||
device, virtualDeviceId);
|
||||
} catch (RemoteException e) {
|
||||
e.rethrowFromSystemServer();
|
||||
if (virtualDevice != null) {
|
||||
try {
|
||||
final int virtualDeviceId = virtualDevice.getDeviceId();
|
||||
mLogicalDisplayMapper.associateDisplayDeviceWithVirtualDevice(
|
||||
device, virtualDeviceId);
|
||||
} 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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user