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

Commit a3514c3a authored by Dan Sandler's avatar Dan Sandler Committed by Android (Google) Code Review
Browse files

Merge "Prevent dismissing autoredacted private notifications." into lmp-dev

parents 5c95b3de 0d3e62f3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1097,6 +1097,8 @@ public abstract class BaseStatusBar extends SystemUI implements
            entry.autoRedacted = true;
        }

        row.setClearable(sbn.isClearable());

        row.setDrawingCacheEnabled(true);

        if (MULTIUSER_DEBUG) {
+25 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    private NotificationContentView mPrivateLayout;
    private int mMaxExpandHeight;
    private View mVetoButton;
    private boolean mClearable;

    public ExpandableNotificationRow(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -165,6 +166,23 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        notifyHeightChanged();
    }

    /**
     * @return Can the underlying notification be cleared?
     */
    public boolean isClearable() {
        return mClearable;
    }

    /**
     * Set whether the notification can be cleared.
     *
     * @param clearable
     */
    public void setClearable(boolean clearable) {
        mClearable = clearable;
        updateVetoButton();
    }

    /**
     * Apply an expansion state to the layout.
     */
@@ -223,6 +241,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        // TODO: animation?
        mPublicLayout.setVisibility(show ? View.VISIBLE : View.GONE);
        mPrivateLayout.setVisibility(show ? View.GONE : View.VISIBLE);

        updateVetoButton();
    }

    private void updateVetoButton() {
        // public versions cannot be dismissed
        mVetoButton.setVisibility(isClearable() && !mShowingPublic ? View.VISIBLE : View.GONE);
    }

    public int getMaxExpandHeight() {