Merge "Fix stray ProfileSelectDialog when only one profile exists" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
0f687eafc5
@@ -299,6 +299,7 @@ class ZenModePrioritySendersPreferenceController
|
|||||||
List<UserHandle> userProfiles = mUserManager.getEnabledProfiles();
|
List<UserHandle> userProfiles = mUserManager.getEnabledProfiles();
|
||||||
if (userProfiles.size() <= 1) {
|
if (userProfiles.size() <= 1) {
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mProfileSelectDialog = ProfileSelectDialog.createDialog(mContext, userProfiles,
|
mProfileSelectDialog = ProfileSelectDialog.createDialog(mContext, userProfiles,
|
||||||
|
@@ -1545,6 +1545,21 @@ public final class ZenModePrioritySendersPreferenceControllerTest {
|
|||||||
assertThat(nextActivity.getAction()).isEqualTo(Intent.ACTION_MAIN);
|
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
|
@Test
|
||||||
public void contactsSettingsClick_multipleProfiles_showsProfileChooserDialog() {
|
public void contactsSettingsClick_multipleProfiles_showsProfileChooserDialog() {
|
||||||
String contactsPackage = mContext.getString(R.string.config_contacts_package_name);
|
String contactsPackage = mContext.getString(R.string.config_contacts_package_name);
|
||||||
|
Reference in New Issue
Block a user