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

Commit 0a65f0ef authored by Ady Abraham's avatar Ady Abraham
Browse files

DisplayModeService: check for null before accessing display mode

Bug: 170502573
Bug: 192354057
Test: systemui votes for a preferredRefreshRate that is not supported
by the device

Change-Id: I36fed8e4c9d4c2990d2bc5247f6fb580af551220
parent b62b9c3e
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1528,8 +1528,14 @@ public final class DisplayManagerService extends SystemService {
            if (requestedModeId == 0 && requestedRefreshRate != 0) {
                // Scan supported modes returned by display.getInfo() to find a mode with the same
                // size as the default display mode but with the specified refresh rate instead.
                requestedModeId = display.getDisplayInfoLocked().findDefaultModeByRefreshRate(
                        requestedRefreshRate).getModeId();
                Display.Mode mode = display.getDisplayInfoLocked().findDefaultModeByRefreshRate(
                        requestedRefreshRate);
                if (mode != null) {
                    requestedModeId = mode.getModeId();
                } else {
                    Slog.e(TAG, "Couldn't find a mode for the requestedRefreshRate: "
                            + requestedRefreshRate + " on Display: " + displayId);
                }
            }
            mDisplayModeDirector.getAppRequestObserver().setAppRequest(
                    displayId, requestedModeId, requestedMaxRefreshRate);