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

Commit b6159811 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Rename SENSITIVE_CONTENT redaction type, fix creation time calculation" into main

parents 7b5de42c da458dd4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ import static android.provider.Settings.Secure.LOCK_SCREEN_SHOW_NOTIFICATIONS;

import static com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_NONE;
import static com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_PUBLIC;
import static com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_SENSITIVE_CONTENT;
import static com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_OTP;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
@@ -693,7 +693,7 @@ public class NotificationLockscreenUserManagerTest extends SysuiTestCase {
        mLockscreenUserManager.mConnectedToWifi.set(false);

        // Sensitive Content notifications are always redacted
        assertEquals(REDACTION_TYPE_SENSITIVE_CONTENT,
        assertEquals(REDACTION_TYPE_OTP,
                mLockscreenUserManager.getRedactionType(mSensitiveContentNotif));
    }

+3 −3
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package com.android.systemui.statusbar.notification.row;

import static com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_PUBLIC;
import static com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_SENSITIVE_CONTENT;
import static com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_OTP;
import static com.android.systemui.statusbar.NotificationLockscreenUserManager.RedactionType;
import static com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_NONE;
import static com.android.systemui.statusbar.notification.row.NotificationRowContentBinder.FLAG_CONTENT_VIEW_ALL;
@@ -472,7 +472,7 @@ public class NotificationContentInflaterTest extends SysuiTestCase {
                com.android.systemui.res.R.drawable.ic_person).setStyle(messagingStyle).build();
        ExpandableNotificationRow row = mHelper.createRow(messageNotif);
        inflateAndWait(false, mNotificationInflater, FLAG_CONTENT_VIEW_PUBLIC,
                REDACTION_TYPE_SENSITIVE_CONTENT, row);
                REDACTION_TYPE_OTP, row);
        NotificationContentView publicView = row.getPublicLayout();
        assertNotNull(publicView);
        // The display name should be included, but not the content or message text
@@ -493,7 +493,7 @@ public class NotificationContentInflaterTest extends SysuiTestCase {
                .build();
        ExpandableNotificationRow row = mHelper.createRow(notif);
        inflateAndWait(false, mNotificationInflater, FLAG_CONTENT_VIEW_PUBLIC,
                REDACTION_TYPE_SENSITIVE_CONTENT, row);
                REDACTION_TYPE_OTP, row);
        NotificationContentView publicView = row.getPublicLayout();
        assertNotNull(publicView);
        assertFalse(hasText(publicView, contentText));
+3 −3
Original line number Diff line number Diff line
@@ -36,8 +36,8 @@ import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.res.R
import com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_NONE
import com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_OTP
import com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_PUBLIC
import com.android.systemui.statusbar.NotificationLockscreenUserManager.REDACTION_TYPE_SENSITIVE_CONTENT
import com.android.systemui.statusbar.NotificationLockscreenUserManager.RedactionType
import com.android.systemui.statusbar.chips.notification.shared.StatusBarNotifChips
import com.android.systemui.statusbar.notification.ConversationNotificationProcessor
@@ -538,7 +538,7 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() {
            false,
            notificationInflater,
            FLAG_CONTENT_VIEW_PUBLIC,
            REDACTION_TYPE_SENSITIVE_CONTENT,
            REDACTION_TYPE_OTP,
            newRow,
        )
        // The display name should be included, but not the content or message text
@@ -566,7 +566,7 @@ class NotificationRowContentBinderImplTest : SysuiTestCase() {
            false,
            notificationInflater,
            FLAG_CONTENT_VIEW_PUBLIC,
            REDACTION_TYPE_SENSITIVE_CONTENT,
            REDACTION_TYPE_OTP,
            newRow,
        )
        var publicView = newRow.publicLayout
+2 −2
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ public interface NotificationLockscreenUserManager {
            value = {
                    REDACTION_TYPE_NONE,
                    REDACTION_TYPE_PUBLIC,
                    REDACTION_TYPE_SENSITIVE_CONTENT})
                    REDACTION_TYPE_OTP})
    @interface RedactionType {}

    /**
@@ -52,7 +52,7 @@ public interface NotificationLockscreenUserManager {
     * Indicates that a notification should have its main content redacted, due to detected
     * sensitive content, such as a One-Time Password
     */
    int REDACTION_TYPE_SENSITIVE_CONTENT = 1 << 1;
    int REDACTION_TYPE_OTP = 1 << 1;

    /**
     * @param userId user Id
+2 −2
Original line number Diff line number Diff line
@@ -795,7 +795,7 @@ public class NotificationLockscreenUserManagerImpl implements
        }

        if (shouldShowSensitiveContentRedactedView(ent)) {
            return REDACTION_TYPE_SENSITIVE_CONTENT;
            return REDACTION_TYPE_OTP;
        }
        return REDACTION_TYPE_NONE;
    }
@@ -920,7 +920,7 @@ public class NotificationLockscreenUserManagerImpl implements
    // notification's "when" time, or the notification entry creation time
    private long getEarliestNotificationTime(NotificationEntry notif) {
        long notifWhenWallClock = notif.getSbn().getNotification().getWhen();
        long creationTimeDelta = SystemClock.elapsedRealtime() - notif.getCreationTime();
        long creationTimeDelta = SystemClock.uptimeMillis() - notif.getCreationTime();
        long creationTimeWallClock = System.currentTimeMillis() - creationTimeDelta;
        return Math.min(notifWhenWallClock, creationTimeWallClock);
    }
Loading