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

Commit 9c6f1aa7 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Fix channel configurability check

Test: atest
Fixes: 128669244
Change-Id: Ib4bc666262426ea1fb8fc034a361c93bdd5afb36
parent 7960cf60
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -111,6 +111,9 @@ public abstract class NotificationPreferenceController extends AbstractPreferenc
    }

    protected boolean isChannelConfigurable() {
        if (mAppRow != null && mAppRow.lockedImportance) {
            return false;
        }
        if (mChannel != null && mAppRow != null) {
            return !Objects.equals(mChannel.getId(), mAppRow.lockedChannelId);
        }
+14 −0
Original line number Diff line number Diff line
@@ -218,6 +218,20 @@ public class NotificationPreferenceControllerTest {
        assertTrue(mController.isChannelConfigurable());
    }

    @Test
    public void testIsConfigurable_appLevel() {
        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
        appRow.lockedChannelId = "something";
        appRow.lockedImportance = true;

        mController.onResume(appRow, mock(NotificationChannel.class), null, null);
        assertFalse(mController.isChannelConfigurable());

        appRow.lockedImportance = false;
        mController.onResume(appRow, mock(NotificationChannel.class), null, null);
        assertTrue(mController.isChannelConfigurable());
    }

    @Test
    public void testIsChannelBlockable_nonSystemAppsBlockable() {
        NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();