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

Commit c1388641 authored by Nate Myren's avatar Nate Myren
Browse files

Directly check lockscreen redaction flag for redaction

The "LockscreenOtpRedaction.isEnabled" value had a dependency on the
AsyncHybridViewInflation flag. However, only the single-line redacted
view portion of the otp redaction depends on this flag. Add a
"isSingleLineViewEnabled" value that reflects this dependency

Bug: 371843309
Flag: android.app.redact_sensitive_content_notifications_on_lockscreen
Test: manual
Change-Id: I92959a2e0498093e2306d8366adc62ad12a2a43d
parent 784188cf
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -275,7 +275,8 @@ public class NotificationRowBinderImpl implements NotificationRowBinder {
            }
        }

        if (LockscreenOtpRedaction.isEnabled()) {
        if (LockscreenOtpRedaction.isSingleLineViewEnabled()) {

            if (inflaterParams.isChildInGroup() && needsRedaction) {
                params.requireContentViews(FLAG_CONTENT_VIEW_PUBLIC_SINGLE_LINE);
            } else {
+1 −1
Original line number Diff line number Diff line
@@ -1015,7 +1015,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
        mNotificationParent = isChildInGroup ? parent : null;
        mPrivateLayout.setIsChildInGroup(isChildInGroup);
        if (LockscreenOtpRedaction.isEnabled()) {
        if (LockscreenOtpRedaction.isSingleLineViewEnabled()) {
            mPublicLayout.setIsChildInGroup(isChildInGroup);
        }

+5 −5
Original line number Diff line number Diff line
@@ -223,7 +223,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder
                    );
        }

        if (LockscreenOtpRedaction.isEnabled()) {
        if (LockscreenOtpRedaction.isSingleLineViewEnabled()) {
            result.mPublicInflatedSingleLineViewModel =
                    SingleLineViewInflater.inflateRedactedSingleLineViewModel(row.getContext(),
                            isConversation);
@@ -309,7 +309,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder
                });
                break;
            case FLAG_CONTENT_VIEW_PUBLIC_SINGLE_LINE:
                if (LockscreenOtpRedaction.isEnabled()) {
                if (LockscreenOtpRedaction.isSingleLineViewEnabled()) {
                    row.getPublicLayout()
                            .performWhenContentInactive(VISIBLE_TYPE_SINGLELINE, () -> {
                                row.getPublicLayout().setSingleLineView(null);
@@ -360,7 +360,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder
        if ((contentViews & FLAG_CONTENT_VIEW_PUBLIC) != 0) {
            row.getPublicLayout().removeContentInactiveRunnable(VISIBLE_TYPE_CONTRACTED);
        }
        if (LockscreenOtpRedaction.isEnabled()
        if (LockscreenOtpRedaction.isSingleLineViewEnabled()
                && (contentViews & FLAG_CONTENT_VIEW_PUBLIC_SINGLE_LINE) != 0) {
            row.getPublicLayout().removeContentInactiveRunnable(VISIBLE_TYPE_SINGLELINE);
        }
@@ -974,7 +974,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder
            }
        }

        if (LockscreenOtpRedaction.isEnabled()
        if (LockscreenOtpRedaction.isSingleLineViewEnabled()
                && (reInflateFlags & FLAG_CONTENT_VIEW_PUBLIC_SINGLE_LINE) != 0) {
            HybridNotificationView view = result.mPublicInflatedSingleLineView;
            SingleLineViewModel viewModel = result.mPublicInflatedSingleLineViewModel;
@@ -1254,7 +1254,7 @@ public class NotificationContentInflater implements NotificationRowContentBinder
                        );
            }

            if (LockscreenOtpRedaction.isEnabled()) {
            if (LockscreenOtpRedaction.isSingleLineViewEnabled()) {
                result.mPublicInflatedSingleLineViewModel =
                        SingleLineViewInflater.inflateRedactedSingleLineViewModel(mContext,
                                isConversation);
+5 −2
Original line number Diff line number Diff line
@@ -30,6 +30,9 @@ object LockscreenOtpRedaction {

    @JvmStatic
    inline val isEnabled
        get() =
            redactSensitiveContentNotificationsOnLockscreen() && AsyncHybridViewInflation.isEnabled
        get() = redactSensitiveContentNotificationsOnLockscreen()

    @JvmStatic
    inline val isSingleLineViewEnabled
        get() = isEnabled && AsyncHybridViewInflation.isEnabled
}