Loading src/com/android/settings/notification/SummarizationCombinedPreferenceController.java +1 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ public class SummarizationCombinedPreferenceController extends BasePreferenceCon mWorkPref = category.findPreference(WORK_PREF_KEY); if (mWorkPref != null) { mWorkPref.setVisible(hasManagedProfile()); mWorkPref.setOnPreferenceChangeListener(mWorkPrefListener); } Loading tests/robotests/src/com/android/settings/notification/SummarizationCombinedPreferenceControllerTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,19 @@ public class SummarizationCombinedPreferenceControllerTest { assertThat(mGlobalSwitch.isChecked()).isFalse(); } @Test public void updateState_workSwitch_notVisibleWhenNoManagedProfile() { when(mBackend.isNotificationSummarizationEnabled(anyInt())).thenReturn(true); mController.setManagedProfile(null); mController.updateState(mPrefCategory); // The controller + main switch should be functional, but the work switch should not be // visible assertThat(mController.isAvailable()).isTrue(); assertThat(mGlobalSwitch.isChecked()).isTrue(); assertThat(mWorkSwitch.isVisible()).isFalse(); } @Test public void updateState_hasManagedProfile_reflectsSettings() { // setup: has a work profile with summarization enabled Loading Loading
src/com/android/settings/notification/SummarizationCombinedPreferenceController.java +1 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ public class SummarizationCombinedPreferenceController extends BasePreferenceCon mWorkPref = category.findPreference(WORK_PREF_KEY); if (mWorkPref != null) { mWorkPref.setVisible(hasManagedProfile()); mWorkPref.setOnPreferenceChangeListener(mWorkPrefListener); } Loading
tests/robotests/src/com/android/settings/notification/SummarizationCombinedPreferenceControllerTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,19 @@ public class SummarizationCombinedPreferenceControllerTest { assertThat(mGlobalSwitch.isChecked()).isFalse(); } @Test public void updateState_workSwitch_notVisibleWhenNoManagedProfile() { when(mBackend.isNotificationSummarizationEnabled(anyInt())).thenReturn(true); mController.setManagedProfile(null); mController.updateState(mPrefCategory); // The controller + main switch should be functional, but the work switch should not be // visible assertThat(mController.isAvailable()).isTrue(); assertThat(mGlobalSwitch.isChecked()).isTrue(); assertThat(mWorkSwitch.isVisible()).isFalse(); } @Test public void updateState_hasManagedProfile_reflectsSettings() { // setup: has a work profile with summarization enabled Loading