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

Commit 7d75ee7b authored by Dorin Drimus's avatar Dorin Drimus
Browse files

Fix NPE when display is not connected when onSecureWindowShown is called

Bug: 385377064
Test: atest ActivityManagementTest
Flag: EXEMPT minor NPE fix
Change-Id: I6791846c704eed70e5cb6c183e6bf32968a1eed4
parent 1f39ebe0
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -301,6 +301,7 @@ final class VirtualDeviceImpl extends IVirtualDevice.Stub
            // if the secure window is shown on a non-secure virtual display.
            DisplayManager displayManager = mContext.getSystemService(DisplayManager.class);
            Display display = displayManager.getDisplay(displayId);
            if (display != null) {
                if ((display.getFlags() & Display.FLAG_SECURE) == 0) {
                    showToastWhereUidIsRunning(activityInfo.applicationInfo.uid,
                            com.android.internal.R.string.vdm_secure_window,
@@ -310,6 +311,10 @@ final class VirtualDeviceImpl extends IVirtualDevice.Stub
                            "virtual_devices.value_secure_window_blocked_count",
                            mAttributionSource.getUid());
                }
            } else {
                Slog.e(TAG, "Calling onSecureWindowShown on a non existent/connected display: "
                        + displayId);
            }
        }

        @Override