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

Commit d51af690 authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Add null check for DisplayInfo of DEFAULT_DISPLAY

We are getting reports of DisplayInfo being null in this part of code.
The API "getDisplayInfo" is allowed to return null, so add this check
here.

Separately, we will discuss with the display manager team whether it's
normal / reasonable for the lookup of DEFAULT_DISPLAY to fail.

Bug: 331692058
Test: none
Change-Id: I1e89289ffa56b0c4459079aae035073d095788c9
parent bb8ac426
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -234,6 +234,9 @@ final class AmbientKeyboardBacklightController implements DisplayManager.Display
        DisplayManagerInternal displayManagerInternal = LocalServices.getService(
                DisplayManagerInternal.class);
        DisplayInfo displayInfo = displayManagerInternal.getDisplayInfo(Display.DEFAULT_DISPLAY);
        if (displayInfo == null) {
            return;
        }
        synchronized (sAmbientControllerLock) {
            if (Objects.equals(mCurrentDefaultDisplayUniqueId, displayInfo.uniqueId)) {
                return;