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

Commit 16262bab authored by Vladimir Komsiyski's avatar Vladimir Komsiyski
Browse files

Do not crash when trying to sleep non-existent display

The display may have been released between the
PowerManager#goToSleep call and the check in
PowerManagerService.

Fix: 435748228
Test: presubmit
Flag: EXEMPT bugfix
Change-Id: Ic9c9ffae9248dd2baa289796defd63e1e0fdf708
parent 587b819d
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -6460,8 +6460,10 @@ public final class PowerManagerService extends SystemService
                groupIds = mDisplayManagerInternal.getDisplayGroupIds();
            } else {
                DisplayInfo displayInfo = mDisplayManagerInternal.getDisplayInfo(displayId);
                Preconditions.checkArgument(displayInfo != null, "display ID(%d) doesn't exist",
                        displayId);
                if (displayInfo == null) {
                    Slog.w(TAG, "Can not sleep non-existent display ID " + displayId);
                    return;
                }
                int groupId = displayInfo.displayGroupId;
                if (groupId == Display.INVALID_DISPLAY_GROUP) {
                    throw new IllegalArgumentException("invalid display group ID");