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

Commit 24afe0e6 authored by Lyn Han's avatar Lyn Han Committed by Android (Google) Code Review
Browse files

Merge "Fix classified notif showing in alerting section" into main

parents afb99783 38c315fc
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -16,7 +16,9 @@

package com.android.systemui.statusbar.notification.collection.coordinator;

import static android.app.NotificationChannel.SYSTEM_RESERVED_IDS;
import static android.app.NotificationManager.IMPORTANCE_DEFAULT;
import static android.app.NotificationManager.IMPORTANCE_LOW;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST;

@@ -339,6 +341,13 @@ public class RankingCoordinatorTest extends SysuiTestCase {
        verify(mSilentHeaderController, times(2)).setClearSectionEnabled(eq(false));
    }

    @Test
    public void testAlertingSectioner_rejectsBundle() {
        for (String id : SYSTEM_RESERVED_IDS) {
            assertFalse(mAlertingSectioner.isInSection(makeClassifiedNotifEntry(id)));
        }
    }

    @Test
    public void statusBarStateCallbackTest() {
        mStatusBarStateCallback.onDozeAmountChanged(1f, 1f);
@@ -392,4 +401,11 @@ public class RankingCoordinatorTest extends SysuiTestCase {
                .build());
        assertEquals(ambient, mEntry.getRanking().isAmbient());
    }

    private NotificationEntry makeClassifiedNotifEntry(String channelId) {
        NotificationChannel channel = new NotificationChannel(channelId, channelId, IMPORTANCE_LOW);
        return new NotificationEntryBuilder()
                .updateRanking((rankingBuilder -> rankingBuilder.setChannel(channel)))
                .build();
    }
}
+7 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.statusbar.notification.collection.coordinator;

import static android.app.NotificationChannel.SYSTEM_RESERVED_IDS;

import android.annotation.NonNull;
import android.annotation.Nullable;

@@ -99,7 +101,11 @@ public class RankingCoordinator implements Coordinator {
            NotificationPriorityBucketKt.BUCKET_ALERTING) {
        @Override
        public boolean isInSection(PipelineEntry entry) {
            return mHighPriorityProvider.isHighPriority(entry);
            return mHighPriorityProvider.isHighPriority(entry)
                    && entry.getRepresentativeEntry() != null
                    && entry.getRepresentativeEntry().getChannel() != null
                    && !SYSTEM_RESERVED_IDS.contains(
                    entry.getRepresentativeEntry().getChannel().getId());
        }

        @Nullable