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

Commit 064b9605 authored by Chloris Kuo's avatar Chloris Kuo Committed by Android (Google) Code Review
Browse files

Merge "Disable Enhanced notifications setting when default NAS is not available"

parents a5069dbd 873b8544
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -140,7 +140,10 @@ public class NotificationAssistantPreferenceController extends TogglePreferenceC
    @Override
    public void updateState(Preference preference) {
        super.updateState(preference);
        if (isNASSettingActivityAvailable()) {
        if (mDefaultNASComponent == null) {
            preference.setEnabled(false);
            ((PrimarySwitchPreference) preference).setSwitchEnabled(false);
        } else if (isNASSettingActivityAvailable()) {
            preference.setIntent(mNASSettingIntent);
        } else {
            // Cannot find settings activity from the default NAS app
+10 −0
Original line number Diff line number Diff line
@@ -226,4 +226,14 @@ public class NotificationAssistantPreferenceControllerTest {
                .setNASMigrationDoneAndResetDefault(eq(10), anyBoolean());
    }

    @Test
    public void testNASUnavailable_settingDisabled() throws Exception {
        when(mBackend.getDefaultNotificationAssistant()).thenReturn(null);
        mPreferenceController.getDefaultNASIntent();
        mPreferenceController.updateState(mPreference);

        verify(mPreference, times(1)).setSwitchEnabled(eq(false));
        assertFalse(mPreference.isEnabled());
    }

}