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

Commit 0f687eaf authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix stray ProfileSelectDialog when only one profile exists" into main

parents 3d21de7e b152c2d3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -299,6 +299,7 @@ class ZenModePrioritySendersPreferenceController
        List<UserHandle> userProfiles = mUserManager.getEnabledProfiles();
        if (userProfiles.size() <= 1) {
            mContext.startActivity(intent);
            return;
        }

        mProfileSelectDialog = ProfileSelectDialog.createDialog(mContext, userProfiles,
+15 −0
Original line number Diff line number Diff line
@@ -1545,6 +1545,21 @@ public final class ZenModePrioritySendersPreferenceControllerTest {
        assertThat(nextActivity.getAction()).isEqualTo(Intent.ACTION_MAIN);
    }

    @Test
    public void contactsSettingsClick_singleProfile_opensActivityWithoutDialog() {
        String contactsPackage = mContext.getString(R.string.config_contacts_package_name);
        setUpContactsApp(contactsPackage, /* withPreciseIntents= */ true);

        mCallsController.displayPreference(mPreferenceScreen);
        mCallsController.updateZenMode(mCallsPrefCategory, TestModeBuilder.EXAMPLE);
        SelectorWithWidgetPreference contactsPref = getBoundSelectorPreference(KEY_CONTACTS);

        contactsPref.getExtraWidget().performClick();

        assertThat(ShadowDialog.getLatestDialog()).isNull();
        assertThat(shadowOf(mActivity).getNextStartedActivity()).isNotNull();
    }

    @Test
    public void contactsSettingsClick_multipleProfiles_showsProfileChooserDialog() {
        String contactsPackage = mContext.getString(R.string.config_contacts_package_name);