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

Commit 0632717b authored by Jan Sebechlebsky's avatar Jan Sebechlebsky Committed by Ján Sebechlebský
Browse files

Avoid instantiating VDM for default device+display context.

Bug: 331850963
Test: atest VirtualDeviceManagerBasicTest
Change-Id: I32310d4175ea165511023e9b6f4070224bd8036b
parent 079a54da
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -3144,6 +3144,14 @@ class ContextImpl extends Context {
        if (mIsExplicitDeviceId) {
            return;
        }

        if ((displayId == Display.DEFAULT_DISPLAY || displayId == Display.INVALID_DISPLAY)
                && mDeviceId == DEVICE_ID_DEFAULT) {
            // DEFAULT_DISPLAY & INVALID_DISPLAY are associated with default device.
            // Return early avoiding instantiating VDM when it's not needed.
            return;
        }

        VirtualDeviceManager vdm = getSystemService(VirtualDeviceManager.class);
        if (vdm != null) {
            int deviceId = vdm.getDeviceIdForDisplayId(displayId);