Fix DecoratedCustomViewStyle with 1-2 actions
When using 1-2 actions, createRemoteViews would
incorrectly use the MAX_ACTION_BUTTONS (3) for the
number of actions. To support 1-2 actions, use the
min() of the number of actions and MAX_ACTION_BUTTONS.
Test: Tested DecoratedCustomViewStyle with 1 action.
BUG: 63133757
Change-Id: I13b531306048e4ff237a30307238a5a24a262af1
diff --git a/v7/appcompat/src/android/support/v7/app/NotificationCompat.java b/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
index 0ec4c77..95b5edd 100644
--- a/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
+++ b/v7/appcompat/src/android/support/v7/app/NotificationCompat.java
@@ -451,7 +451,7 @@
remoteViews.removeAllViews(R.id.actions);
boolean actionsVisible = false;
if (showActions && mBuilder.mActions != null) {
- int numActions = Math.max(mBuilder.mActions.size(), MAX_ACTION_BUTTONS);
+ int numActions = Math.min(mBuilder.mActions.size(), MAX_ACTION_BUTTONS);
if (numActions > 0) {
actionsVisible = true;
for (int i = 0; i < numActions; i++) {