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

Commit c3217eaa authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[RONs] Add ProgressStyle to promotion logic" into main

parents 6c1fa97a 08409a36
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -3216,11 +3216,13 @@ public class Notification implements Parcelable
     */
    @FlaggedApi(Flags.FLAG_UI_RICH_ONGOING)
    public boolean hasPromotableStyle() {
        //TODO(b/367739672): Add progress style
        return extras == null || !extras.containsKey(Notification.EXTRA_TEMPLATE)
                || isStyle(Notification.BigPictureStyle.class)
                || isStyle(Notification.BigTextStyle.class)
                || isStyle(Notification.CallStyle.class);
        final Class<? extends Style> notificationStyle = getNotificationStyle();
        return notificationStyle == null
                || BigPictureStyle.class.equals(notificationStyle)
                || BigTextStyle.class.equals(notificationStyle)
                || CallStyle.class.equals(notificationStyle)
                || ProgressStyle.class.equals(notificationStyle);
    }
    /**
+21 −0
Original line number Diff line number Diff line
@@ -438,6 +438,27 @@ public class NotificationTest {
        assertThat(n.hasPromotableStyle()).isTrue();
    }

    @Test
    @EnableFlags({Flags.FLAG_UI_RICH_ONGOING, Flags.FLAG_API_RICH_ONGOING})
    public void testHasPromotableStyle_progress() {
        Notification n = new Notification.Builder(mContext, "test")
                .setSmallIcon(android.R.drawable.sym_def_app_icon)
                .setStyle(new Notification.ProgressStyle())
                .build();
        assertThat(n.hasPromotableStyle()).isTrue();
    }

    @Test
    @EnableFlags({Flags.FLAG_UI_RICH_ONGOING})
    public void testHasPromotableStyle_unknownStyle() {
        Notification n = new Notification.Builder(mContext, "test")
                .setSmallIcon(android.R.drawable.sym_def_app_icon)
                .setStyle(new NotAPlatformStyle())
                .build();

        assertThat(n.hasPromotableStyle()).isTrue();
    }

    @Test
    @EnableFlags(Flags.FLAG_UI_RICH_ONGOING)
    public void testHasPromotableCharacteristics() {