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

Commit 61143f34 authored by Lyn Han's avatar Lyn Han
Browse files

Move promotion section to last position in bundles

Fixes: 421939469
Test: manual
Flag: com.android.systemui.notification_bundle_ui
Change-Id: Id5017c15c15ebdac6ddab2f871c955ba7741287f
parent b9dd01e2
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -334,20 +334,20 @@ public class RankingCoordinatorTest extends SysuiTestCase {
    public void testSilentSectionComparator_sortsBundlesByPrefixedKeys() {
        // This is the sorted order
        BundleEntry socialBundle = new BundleEntry(BundleSpec.Companion.getSOCIAL_MEDIA());
        BundleEntry promoBundle = new BundleEntry(BundleSpec.Companion.getPROMOTIONS());
        BundleEntry newsBundle = new BundleEntry(BundleSpec.Companion.getNEWS());
        BundleEntry recsBundle = new BundleEntry(BundleSpec.Companion.getRECOMMENDED());
        BundleEntry promoBundle = new BundleEntry(BundleSpec.Companion.getPROMOTIONS());

        // Add them in unsorted order
        List<BundleEntry> bundles = new ArrayList<>(Arrays.asList(
                newsBundle, socialBundle, recsBundle, promoBundle
                promoBundle, newsBundle, socialBundle, recsBundle
        ));
        Collections.sort(bundles, mSilentSectioner.getComparator());

        assertEquals("i=0 expected Social", socialBundle, bundles.get(0));
        assertEquals("i=1 expected Promo", promoBundle, bundles.get(1));
        assertEquals("i=2 expected News", newsBundle, bundles.get(2));
        assertEquals("i=3 expected Recs", recsBundle, bundles.get(3));
        assertEquals("i=1 expected News", newsBundle, bundles.get(1));
        assertEquals("i=2 expected Recs", recsBundle, bundles.get(2));
        assertEquals("i=3 expected Promo", promoBundle, bundles.get(3));
    }

    @Test
+3 −3
Original line number Diff line number Diff line
@@ -66,9 +66,9 @@ public class RankingCoordinator implements Coordinator {
    private static final Map<String, Integer> BUNDLE_KEY_SORT_ORDER = new HashMap<>();
    static {
        BUNDLE_KEY_SORT_ORDER.put(NotificationChannel.SOCIAL_MEDIA_ID, 1);
        BUNDLE_KEY_SORT_ORDER.put(NotificationChannel.PROMOTIONS_ID, 2);
        BUNDLE_KEY_SORT_ORDER.put(NotificationChannel.NEWS_ID, 3);
        BUNDLE_KEY_SORT_ORDER.put(NotificationChannel.RECS_ID, 4);
        BUNDLE_KEY_SORT_ORDER.put(NotificationChannel.NEWS_ID, 2);
        BUNDLE_KEY_SORT_ORDER.put(NotificationChannel.RECS_ID, 3);
        BUNDLE_KEY_SORT_ORDER.put(NotificationChannel.PROMOTIONS_ID, 4);
        BUNDLE_KEY_SORT_ORDER.put("debug_bundle", 99);
    }