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

Commit 21e913fa authored by Jiaming Liu's avatar Jiaming Liu
Browse files

Guard mRearDisplayPendingOverrideRequest with mLock

mRearDisplayPendingOverrideRequest was null checked before acquiring the lock, which potentially caused the NullPointerException because the value might have changed while waiting on the lock.

Bug: 287264582
Change-Id: Ia14ca58a7d608ae95e1804dbcc5ab141f6f3b27c
Test: Manual
parent 439d52f9
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -172,6 +172,7 @@ public final class DeviceStateManagerService extends SystemService {
    private DeviceState mRearDisplayState;

    // TODO(259328837) Generalize for all pending feature requests in the future
    @GuardedBy("mLock")
    @Nullable
    private OverrideRequest mRearDisplayPendingOverrideRequest;

@@ -779,7 +780,7 @@ public final class DeviceStateManagerService extends SystemService {
     * {@link StatusBarManagerInternal} to notify SystemUI to display the educational dialog.
     */
    @GuardedBy("mLock")
    private void showRearDisplayEducationalOverlayLocked(OverrideRequest request) {
    private void showRearDisplayEducationalOverlayLocked(@NonNull OverrideRequest request) {
        mRearDisplayPendingOverrideRequest = request;

        StatusBarManagerInternal statusBar =
@@ -844,8 +845,8 @@ public final class DeviceStateManagerService extends SystemService {
     * request if it was dismissed in a way that should cancel the feature.
     */
    private void onStateRequestOverlayDismissedInternal(boolean shouldCancelRequest) {
        if (mRearDisplayPendingOverrideRequest != null) {
        synchronized (mLock) {
            if (mRearDisplayPendingOverrideRequest != null) {
                if (shouldCancelRequest) {
                    ProcessRecord processRecord = mProcessRecords.get(
                            mRearDisplayPendingOverrideRequest.getPid());