Merge "Remove duel switch from NAS switch" into main

This commit is contained in:
Julia Reynolds
2023-10-26 13:03:16 +00:00
committed by Android (Google) Code Review
3 changed files with 1 additions and 57 deletions

View File

@@ -154,34 +154,6 @@ public class NotificationAssistantPreferenceControllerTest {
verify(mBackend, times(1)).setNotificationAssistantGranted(null);
}
@Test
public void testUpdateState_SettingActivityAvailable() throws Exception {
mPreferenceController.updateState(mPreference);
assertNotNull(mPreference.getIntent());
mPreference.performClick();
Intent nextIntent = Shadows.shadowOf(
(Application) ApplicationProvider.getApplicationContext()).getNextStartedActivity();
assertEquals(nextIntent.getAction(), ACTION_NOTIFICATION_ASSISTANT_DETAIL_SETTINGS);
}
@Test
public void testUpdateState_SettingActivityUnavailable() throws Exception {
when(mPackageManager.queryIntentActivities(any(Intent.class), any()))
.thenReturn(null);
mPreferenceController.updateState(mPreference);
assertNull(mPreference.getIntent());
mPreference.performClick();
Intent nextIntent = Shadows.shadowOf(
(Application) ApplicationProvider.getApplicationContext()).getNextStartedActivity();
assertNull(nextIntent);
// Verify a dialog is shown
verify(mFragmentTransaction).add(
any(NotificationAssistantDialogFragment.class), anyString());
verify(mBackend, times(0)).setNotificationAssistantGranted(any());
}
@Test
@Config(shadows = ShadowSecureSettings.class)
public void testMigrationFromSetting_userEnable_multiProfile() throws Exception {
@@ -229,14 +201,4 @@ public class NotificationAssistantPreferenceControllerTest {
verify(mBackend, never())
.setNASMigrationDoneAndResetDefault(eq(10), anyBoolean());
}
@Test
public void testNASUnavailable_settingDisabled() throws Exception {
when(mBackend.getDefaultNotificationAssistant()).thenReturn(null);
mPreferenceController.getDefaultNASIntent();
mPreferenceController.updateState(mPreference);
verify(mPreference, atLeastOnce()).setSwitchEnabled(eq(false));
assertFalse(mPreference.isEnabled());
}
}