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

Commit 04762e2c authored by Shen Lin's avatar Shen Lin
Browse files

Fix NPE in requestPowerState when displayPowerController is null

We get displayPowerController object from a SparseArray so it would be
better to guard by a lock object or add a null check.

Bug: 315308333
Test: atest, manual
Change-Id: Ic6713d85aa09e660c9dc14f01ac05c4d394922fd
parent 0ae7fbc3
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -4337,10 +4337,12 @@ public final class DisplayManagerService extends SystemService {
                    if ((flags & DisplayDeviceInfo.FLAG_NEVER_BLANK) == 0) {
                        final DisplayPowerControllerInterface displayPowerController =
                                mDisplayPowerControllers.get(id);
                        if (displayPowerController != null) {
                            ready &= displayPowerController.requestPowerState(request,
                                    waitForNegativeProximity);
                        }
                    }
                }

                return ready;
            }