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

Commit 10504c50 authored by Ján Sebechlebský's avatar Ján Sebechlebský Committed by Android (Google) Code Review
Browse files

Merge "Avoid instantiating VDM for default device+display context." into main

parents 07fc46a1 0632717b
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);