Prevent dismissing autoredacted private notifications.
Bug: 16295169
Change-Id: Ic1a13ae1a501ae4a5633ef9c84c59ff13543eb1b
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index c667980..56ea359 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -1097,6 +1097,8 @@
entry.autoRedacted = true;
}
+ row.setClearable(sbn.isClearable());
+
row.setDrawingCacheEnabled(true);
if (MULTIUSER_DEBUG) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index 280bade..3410834 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -53,6 +53,7 @@
private NotificationContentView mPrivateLayout;
private int mMaxExpandHeight;
private View mVetoButton;
+ private boolean mClearable;
public ExpandableNotificationRow(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -166,6 +167,23 @@
}
/**
+ * @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.
*/
public void applyExpansionToLayout() {
@@ -223,6 +241,13 @@
// 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() {