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

Commit 1707741a authored by Nate Myren's avatar Nate Myren Committed by Android (Google) Code Review
Browse files

Merge "Replace kgm call with local in shouldShowRedacted" into main

parents 99b5b1cf 5b8ca021
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -526,7 +526,7 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase {
        mLockscreenUserManager.mLastLockTime
                .set(mSensitiveNotifPostTime - TimeUnit.DAYS.toMillis(1));
        // Device is not currently locked
        when(mKeyguardManager.isDeviceLocked()).thenReturn(false);
        mLockscreenUserManager.mLocked.set(false);

        // Sensitive Content notifications are always redacted
        assertEquals(REDACTION_TYPE_NONE,
@@ -540,7 +540,7 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase {
        mSettings.putIntForUser(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 1,
                mCurrentUser.id);
        changeSetting(LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS);
        when(mKeyguardManager.isDeviceLocked()).thenReturn(true);
        mLockscreenUserManager.mLocked.set(true);
        // Device was locked after this notification arrived
        mLockscreenUserManager.mLastLockTime
                .set(mSensitiveNotifPostTime + TimeUnit.DAYS.toMillis(1));
@@ -560,7 +560,7 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase {
        // Device has been locked for 1 second before the notification came in, which is too short
        mLockscreenUserManager.mLastLockTime
                .set(mSensitiveNotifPostTime - TimeUnit.SECONDS.toMillis(1));
        when(mKeyguardManager.isDeviceLocked()).thenReturn(true);
        mLockscreenUserManager.mLocked.set(true);

        // Sensitive Content notifications are always redacted
        assertEquals(REDACTION_TYPE_NONE,
@@ -577,7 +577,7 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase {
        // Claim the device was last locked 1 day ago
        mLockscreenUserManager.mLastLockTime
                .set(mSensitiveNotifPostTime - TimeUnit.DAYS.toMillis(1));
        when(mKeyguardManager.isDeviceLocked()).thenReturn(true);
        mLockscreenUserManager.mLocked.set(true);

        // Sensitive Content notifications are always redacted
        assertEquals(REDACTION_TYPE_NONE,
+6 −1
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ import java.util.List;
import java.util.Objects;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;

import javax.inject.Inject;
@@ -297,6 +298,9 @@ public class NotificationLockscreenUserManagerImpl implements
    // The last lock time. Uses currentTimeMillis
    @VisibleForTesting
    protected final AtomicLong mLastLockTime = new AtomicLong(-1);
    // Whether or not the device is locked
    @VisibleForTesting
    protected final AtomicBoolean mLocked = new AtomicBoolean(true);

    protected int mCurrentUserId = 0;

@@ -369,6 +373,7 @@ public class NotificationLockscreenUserManagerImpl implements
                        if (!unlocked) {
                            mLastLockTime.set(System.currentTimeMillis());
                        }
                        mLocked.set(!unlocked);
                    }));
        }
    }
@@ -737,7 +742,7 @@ public class NotificationLockscreenUserManagerImpl implements
            return false;
        }

        if (!mKeyguardManager.isDeviceLocked()) {
        if (!mLocked.get()) {
            return false;
        }