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

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

Merge "Remove metrics flag for lockscreen redaction" into main

parents 03b40c59 37d08161
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -220,16 +220,6 @@ flag {
  bug: "343631648"
}

flag {
  name: "redaction_on_lockscreen_metrics"
  namespace: "systemui"
  description: "enables metrics when redacting notifications on the lockscreen"
  bug: "343631648"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "expanding_public_view"
  namespace: "systemui"
+1 −52
Original line number Diff line number Diff line
@@ -762,57 +762,6 @@ public class NotificationLockscreenUserManagerImpl implements
        return REDACTION_TYPE_NONE;
    }

    /*
     * We show the sensitive content redaction view if
     * 1. The feature is enabled
     * 2. The device is locked
     * 3. The device is NOT connected to Wifi
     * 4. The notification has the `hasSensitiveContent` ranking variable set to true
     * 5. The device has not connected to Wifi since receiving the notification
     * 6. The notification arrived at least LOCK_TIME_FOR_SENSITIVE_REDACTION_MS before the last
     *    lock time.
     */
    private boolean shouldShowSensitiveContentRedactedView(NotificationEntry ent) {
        if (android.app.Flags.redactionOnLockscreenMetrics()) {
            return shouldShowSensitiveContentRedactedViewWithLog(ent);
        }

        if (!LockscreenOtpRedaction.isEnabled()) {
            return false;
        }

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

        long notificationTime = getEarliestNotificationTime(ent);
        if (!mRedactOtpOnWifi.get()) {
            if (mConnectedToWifi.get()) {
                return false;
            }

            long lastWifiConnectTime = mLastWifiConnectionTime.get();
            // If the device has connected to wifi since receiving the notification, do not redact
            if (notificationTime < lastWifiConnectTime) {
                return false;
            }
        }

        if (ent.getRanking() == null || !ent.getRanking().hasSensitiveContent()) {
            return false;
        }

        // If the lock screen was not already locked for at least mOtpRedactionRequiredLockTimeMs
        // when this notification arrived, do not redact
        long latestTimeForRedaction = mLastLockTime.get() + mOtpRedactionRequiredLockTimeMs.get();

        if (notificationTime < latestTimeForRedaction) {
            return false;
        }

        return true;
    }

    /*
     * We show the sensitive content redaction view if
     * 1. The feature is enabled
@@ -825,7 +774,7 @@ public class NotificationLockscreenUserManagerImpl implements
     *
     * This version of the method logs a metric about the request.
     */
    private boolean shouldShowSensitiveContentRedactedViewWithLog(NotificationEntry ent) {
    private boolean shouldShowSensitiveContentRedactedView(NotificationEntry ent) {
        if (!LockscreenOtpRedaction.isEnabled()) {
            return false;
        }