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

Commit 37d74e73 authored by Steven Kester Yuwono's avatar Steven Kester Yuwono
Browse files

Remove empty space when suppressing action buttons and there are no buttons left.

This suppression logic only applies when there is a phishing action.

Flag: EXEMPT bugfix
Test: manual
Bug: 429407031
Change-Id: Ibd0665fca66a0dfc6a0c4b7279eeaceb7dc11e7b
parent 7effddaa
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -1837,13 +1837,24 @@ public class NotificationContentView extends FrameLayout implements Notification
            if (DEBUG && !suppressedActionIndices.isEmpty()) {
                Log.d(TAG, "Suppressing actions with indices: " + suppressedActionIndices);
            }
            int suppressedActionCount = 0;
            for (int i = 0; i < actionsList.getChildCount(); i++) {
                View actionBtn = actionsList.getChildAt(i);
                Object actionIndex =
                        actionBtn.getTag(com.android.internal.R.id.notification_action_index_tag);
                boolean suppressAction = actionIndex instanceof Integer
                        && suppressedActionIndices.contains(actionIndex);
                actionBtn.setVisibility(suppressAction ? View.GONE : View.VISIBLE);
                if (suppressAction) {
                    actionBtn.setVisibility(View.GONE);
                    suppressedActionCount++;
                } else {
                    actionBtn.setVisibility(View.VISIBLE);
                }
            }
            // If all the actions in the actionList ViewGroup are suppressed, hide the ViewGroup
            // as well to remove the empty space with no action buttons.
            if (suppressedActionCount >= actionsList.getChildCount()) {
                actionsList.setVisibility(View.GONE);
            }
        }
    }