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

Commit 8ab839b3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix potential NPE in NotificationRecord's KeyguardManager call" into...

Merge "Fix potential NPE in NotificationRecord's KeyguardManager call" into udc-qpr-dev am: 0dca8381 am: 001dd0b6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23795148



Change-Id: I454a5a7d4651d41628ca8ed99fbc208bc9846684
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 1d35ef60 001dd0b6
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ public final class NotificationRecord {
    final int mTargetSdkVersion;
    final int mOriginalFlags;
    private final Context mContext;
    private final KeyguardManager mKeyguardManager;
    private KeyguardManager mKeyguardManager;
    private final PowerManager mPowerManager;
    NotificationUsageStats.SingleNotificationStats stats;
    boolean isCanceled;
@@ -1625,10 +1625,21 @@ public final class NotificationRecord {
    }

    boolean isLocked() {
        return mKeyguardManager.isKeyguardLocked()
        return getKeyguardManager().isKeyguardLocked()
                || !mPowerManager.isInteractive();  // Unlocked AOD
    }

    /**
     * For some early {@link NotificationRecord}, {@link KeyguardManager} can be {@code null} in
     * the constructor. Retrieve it again if it is null.
     */
    private KeyguardManager getKeyguardManager() {
        if (mKeyguardManager == null) {
            mKeyguardManager = mContext.getSystemService(KeyguardManager.class);
        }
        return mKeyguardManager;
    }

    @VisibleForTesting
    static final class Light {
        public final int color;