Loading packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +4 −14 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.UserInfo; import android.content.res.Configuration; import android.content.res.Resources; import android.database.ContentObserver; import android.graphics.Rect; import android.graphics.drawable.Drawable; Loading Loading @@ -967,18 +966,15 @@ public abstract class BaseStatusBar extends SystemUI implements } } protected View bindVetoButtonClickListener(View row, final StatusBarNotification n) { View vetoButton = row.findViewById(R.id.veto); vetoButton.setOnClickListener(new View.OnClickListener() { protected void bindDismissListener(final ExpandableNotificationRow row) { row.setOnDismissListener(new View.OnClickListener() { public void onClick(View v) { // Accessibility feedback v.announceForAccessibility( mContext.getString(R.string.accessibility_notification_dismissed)); performRemoveNotification(n, false /* removeView */); performRemoveNotification(row.getStatusBarNotification(), false /* removeView */); } }); vetoButton.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); return vetoButton; } protected void performRemoveNotification(StatusBarNotification n, boolean removeView) { Loading Loading @@ -1655,9 +1651,7 @@ public abstract class BaseStatusBar extends SystemUI implements } workAroundBadLayerDrawableOpacity(row); View vetoButton = bindVetoButtonClickListener(row, sbn); vetoButton.setContentDescription(mContext.getString( R.string.accessibility_remove_notification)); bindDismissListener(row); // NB: the large icon is now handled entirely by the template Loading Loading @@ -2417,10 +2411,6 @@ public abstract class BaseStatusBar extends SystemUI implements updateHeadsUp(key, entry, shouldPeek, alertAgain); updateNotifications(); // Update the veto button accordingly (and as a result, whether this row is // swipe-dismissable) bindVetoButtonClickListener(entry.row, notification); if (!notification.isClearable()) { // The user may have performed a dismiss action on the notification, since it's // not clearable we should snap it back. Loading packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +38 −11 Original line number Diff line number Diff line Loading @@ -109,7 +109,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { private int mHeadsUpHeight; private View mVetoButton; private int mNotificationColor; private boolean mClearable; private ExpansionLogger mLogger; private String mLoggingKey; private NotificationSettingsIconRow mSettingsIconRow; Loading Loading @@ -280,7 +279,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mPublicLayout.onNotificationUpdated(entry); mShowingPublicInitialized = false; updateNotificationColor(); updateClearability(); if (mIsSummaryWithChildren) { mChildrenContainer.recreateNotificationHeader(mExpandClickListener, mEntry.notification); mChildrenContainer.onNotificationUpdated(); Loading Loading @@ -779,6 +777,14 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { return mGroupParentWhenDismissed; } public void performDismiss() { mVetoButton.performClick(); } public void setOnDismissListener(OnClickListener listener) { mVetoButton.setOnClickListener(listener); } public interface ExpansionLogger { public void logNotificationExpansion(String key, boolean userAction, boolean expanded); } Loading Loading @@ -880,6 +886,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } }); mVetoButton = findViewById(R.id.veto); mVetoButton.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); mVetoButton.setContentDescription(mContext.getString( R.string.accessibility_remove_notification)); // Add the views that we translate to reveal the gear mTranslateableViews = new ArrayList<View>(); Loading @@ -893,6 +902,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mTranslateableViews.remove(mGutsStub); } public View getVetoButton() { return mVetoButton; } public void resetTranslation() { if (mTranslateableViews != null) { for (int i = 0; i < mTranslateableViews.size(); i++) { Loading Loading @@ -1157,10 +1170,25 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } /** * @return Can the underlying notification be cleared? * @return Can the underlying notification be cleared? This can be different from whether the * notification can be dismissed in case notifications are sensitive on the lockscreen. * @see #canViewBeDismissed() */ public boolean isClearable() { return mStatusBarNotification != null && mStatusBarNotification.isClearable(); if (mStatusBarNotification == null || !mStatusBarNotification.isClearable()) { return false; } if (mIsSummaryWithChildren) { List<ExpandableNotificationRow> notificationChildren = mChildrenContainer.getNotificationChildren(); for (int i = 0; i < notificationChildren.size(); i++) { ExpandableNotificationRow child = notificationChildren.get(i); if (!child.isClearable()) { return false; } } } return true; } @Override Loading Loading @@ -1317,7 +1345,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { NotificationContentView showingLayout = getShowingLayout(); showingLayout.updateBackgroundColor(animated); mPrivateLayout.updateExpandButtons(isExpandable()); updateClearability(); mShowingPublicInitialized = true; } Loading Loading @@ -1357,12 +1384,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { return mIsHeadsUp; } private void updateClearability() { // public versions cannot be dismissed mVetoButton.setVisibility(canViewBeDismissed() ? View.VISIBLE : View.GONE); } private boolean canViewBeDismissed() { /** * @return Whether this view is allowed to be dismissed. Only valid for visible notifications as * otherwise some state might not be updated. To request about the general clearability * see {@link #isClearable()}. */ public boolean canViewBeDismissed() { return isClearable() && (!mShowingPublic || !mSensitiveHiddenInGeneral); } Loading packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +12 −12 Original line number Diff line number Diff line Loading @@ -824,7 +824,9 @@ public class NotificationStackScrollLayout extends ViewGroup public static void performDismiss(View v, NotificationGroupManager groupManager, boolean fromAccessibility) { if (v instanceof ExpandableNotificationRow) { if (!(v instanceof ExpandableNotificationRow)) { return; } ExpandableNotificationRow row = (ExpandableNotificationRow) v; if (groupManager.isOnlyChildInGroup(row.getStatusBarNotification())) { ExpandableNotificationRow groupSummary = Loading @@ -834,10 +836,8 @@ public class NotificationStackScrollLayout extends ViewGroup } } row.setDismissed(true, fromAccessibility); } final View veto = v.findViewById(R.id.veto); if (veto != null && veto.getVisibility() != View.GONE) { veto.performClick(); if (row.isClearable()) { row.performDismiss(); } if (DEBUG) Log.v(TAG, "onChildDismissed: " + v); } Loading packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +7 −7 Original line number Diff line number Diff line Loading @@ -173,14 +173,14 @@ public class StackScrollAlgorithm { } public static boolean canChildBeDismissed(View v) { if (v instanceof ExpandableNotificationRow) { if (!(v instanceof ExpandableNotificationRow)) { return false; } ExpandableNotificationRow row = (ExpandableNotificationRow) v; if (row.areGutsExposed()) { return false; } } final View veto = v.findViewById(R.id.veto); return (veto != null && veto.getVisibility() != View.GONE); return row.canViewBeDismissed(); } /** Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +4 −14 Original line number Diff line number Diff line Loading @@ -40,7 +40,6 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.UserInfo; import android.content.res.Configuration; import android.content.res.Resources; import android.database.ContentObserver; import android.graphics.Rect; import android.graphics.drawable.Drawable; Loading Loading @@ -967,18 +966,15 @@ public abstract class BaseStatusBar extends SystemUI implements } } protected View bindVetoButtonClickListener(View row, final StatusBarNotification n) { View vetoButton = row.findViewById(R.id.veto); vetoButton.setOnClickListener(new View.OnClickListener() { protected void bindDismissListener(final ExpandableNotificationRow row) { row.setOnDismissListener(new View.OnClickListener() { public void onClick(View v) { // Accessibility feedback v.announceForAccessibility( mContext.getString(R.string.accessibility_notification_dismissed)); performRemoveNotification(n, false /* removeView */); performRemoveNotification(row.getStatusBarNotification(), false /* removeView */); } }); vetoButton.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); return vetoButton; } protected void performRemoveNotification(StatusBarNotification n, boolean removeView) { Loading Loading @@ -1655,9 +1651,7 @@ public abstract class BaseStatusBar extends SystemUI implements } workAroundBadLayerDrawableOpacity(row); View vetoButton = bindVetoButtonClickListener(row, sbn); vetoButton.setContentDescription(mContext.getString( R.string.accessibility_remove_notification)); bindDismissListener(row); // NB: the large icon is now handled entirely by the template Loading Loading @@ -2417,10 +2411,6 @@ public abstract class BaseStatusBar extends SystemUI implements updateHeadsUp(key, entry, shouldPeek, alertAgain); updateNotifications(); // Update the veto button accordingly (and as a result, whether this row is // swipe-dismissable) bindVetoButtonClickListener(entry.row, notification); if (!notification.isClearable()) { // The user may have performed a dismiss action on the notification, since it's // not clearable we should snap it back. Loading
packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +38 −11 Original line number Diff line number Diff line Loading @@ -109,7 +109,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { private int mHeadsUpHeight; private View mVetoButton; private int mNotificationColor; private boolean mClearable; private ExpansionLogger mLogger; private String mLoggingKey; private NotificationSettingsIconRow mSettingsIconRow; Loading Loading @@ -280,7 +279,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mPublicLayout.onNotificationUpdated(entry); mShowingPublicInitialized = false; updateNotificationColor(); updateClearability(); if (mIsSummaryWithChildren) { mChildrenContainer.recreateNotificationHeader(mExpandClickListener, mEntry.notification); mChildrenContainer.onNotificationUpdated(); Loading Loading @@ -779,6 +777,14 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { return mGroupParentWhenDismissed; } public void performDismiss() { mVetoButton.performClick(); } public void setOnDismissListener(OnClickListener listener) { mVetoButton.setOnClickListener(listener); } public interface ExpansionLogger { public void logNotificationExpansion(String key, boolean userAction, boolean expanded); } Loading Loading @@ -880,6 +886,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } }); mVetoButton = findViewById(R.id.veto); mVetoButton.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); mVetoButton.setContentDescription(mContext.getString( R.string.accessibility_remove_notification)); // Add the views that we translate to reveal the gear mTranslateableViews = new ArrayList<View>(); Loading @@ -893,6 +902,10 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mTranslateableViews.remove(mGutsStub); } public View getVetoButton() { return mVetoButton; } public void resetTranslation() { if (mTranslateableViews != null) { for (int i = 0; i < mTranslateableViews.size(); i++) { Loading Loading @@ -1157,10 +1170,25 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } /** * @return Can the underlying notification be cleared? * @return Can the underlying notification be cleared? This can be different from whether the * notification can be dismissed in case notifications are sensitive on the lockscreen. * @see #canViewBeDismissed() */ public boolean isClearable() { return mStatusBarNotification != null && mStatusBarNotification.isClearable(); if (mStatusBarNotification == null || !mStatusBarNotification.isClearable()) { return false; } if (mIsSummaryWithChildren) { List<ExpandableNotificationRow> notificationChildren = mChildrenContainer.getNotificationChildren(); for (int i = 0; i < notificationChildren.size(); i++) { ExpandableNotificationRow child = notificationChildren.get(i); if (!child.isClearable()) { return false; } } } return true; } @Override Loading Loading @@ -1317,7 +1345,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { NotificationContentView showingLayout = getShowingLayout(); showingLayout.updateBackgroundColor(animated); mPrivateLayout.updateExpandButtons(isExpandable()); updateClearability(); mShowingPublicInitialized = true; } Loading Loading @@ -1357,12 +1384,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { return mIsHeadsUp; } private void updateClearability() { // public versions cannot be dismissed mVetoButton.setVisibility(canViewBeDismissed() ? View.VISIBLE : View.GONE); } private boolean canViewBeDismissed() { /** * @return Whether this view is allowed to be dismissed. Only valid for visible notifications as * otherwise some state might not be updated. To request about the general clearability * see {@link #isClearable()}. */ public boolean canViewBeDismissed() { return isClearable() && (!mShowingPublic || !mSensitiveHiddenInGeneral); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +12 −12 Original line number Diff line number Diff line Loading @@ -824,7 +824,9 @@ public class NotificationStackScrollLayout extends ViewGroup public static void performDismiss(View v, NotificationGroupManager groupManager, boolean fromAccessibility) { if (v instanceof ExpandableNotificationRow) { if (!(v instanceof ExpandableNotificationRow)) { return; } ExpandableNotificationRow row = (ExpandableNotificationRow) v; if (groupManager.isOnlyChildInGroup(row.getStatusBarNotification())) { ExpandableNotificationRow groupSummary = Loading @@ -834,10 +836,8 @@ public class NotificationStackScrollLayout extends ViewGroup } } row.setDismissed(true, fromAccessibility); } final View veto = v.findViewById(R.id.veto); if (veto != null && veto.getVisibility() != View.GONE) { veto.performClick(); if (row.isClearable()) { row.performDismiss(); } if (DEBUG) Log.v(TAG, "onChildDismissed: " + v); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +7 −7 Original line number Diff line number Diff line Loading @@ -173,14 +173,14 @@ public class StackScrollAlgorithm { } public static boolean canChildBeDismissed(View v) { if (v instanceof ExpandableNotificationRow) { if (!(v instanceof ExpandableNotificationRow)) { return false; } ExpandableNotificationRow row = (ExpandableNotificationRow) v; if (row.areGutsExposed()) { return false; } } final View veto = v.findViewById(R.id.veto); return (veto != null && veto.getVisibility() != View.GONE); return row.canViewBeDismissed(); } /** Loading