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

Commit c4332615 authored by Yuri Lin's avatar Yuri Lin Committed by Android (Google) Code Review
Browse files

Merge "Don't show summaries work profile switch if there's no work profile" into main

parents 81ae8c8f 02b075ea
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ public class SummarizationCombinedPreferenceController extends BasePreferenceCon

        mWorkPref = category.findPreference(WORK_PREF_KEY);
        if (mWorkPref != null) {
            mWorkPref.setVisible(hasManagedProfile());
            mWorkPref.setOnPreferenceChangeListener(mWorkPrefListener);
        }

+13 −0
Original line number Diff line number Diff line
@@ -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