use of com.android.settingslib.search.SearchIndexableRaw in project android_packages_apps_Settings by omnirom.
the class AccountPreferenceControllerTest method updateDynamicRawDataToIndex_disallowRemove_shouldAddOne.
@Test
public void updateDynamicRawDataToIndex_disallowRemove_shouldAddOne() {
final List<SearchIndexableRaw> data = new ArrayList<>();
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", UserInfo.FLAG_MANAGED_PROFILE));
when(mUserManager.isManagedProfile()).thenReturn(false);
when(mUserManager.getProfiles(anyInt())).thenReturn(infos);
when(mAccountHelper.hasBaseUserRestriction(eq(UserManager.DISALLOW_REMOVE_MANAGED_PROFILE), anyInt())).thenReturn(true);
mController.updateDynamicRawDataToIndex(data);
assertThat(data.size()).isEqualTo(1);
}
use of com.android.settingslib.search.SearchIndexableRaw in project android_packages_apps_Settings by omnirom.
the class AccountPreferenceControllerTest method updateDynamicRawDataToIndex_managedUser_shouldAddTwo.
@Test
public void updateDynamicRawDataToIndex_managedUser_shouldAddTwo() {
final List<SearchIndexableRaw> data = new ArrayList<>();
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", UserInfo.FLAG_MANAGED_PROFILE));
when(mUserManager.isManagedProfile()).thenReturn(false);
when(mUserManager.getProfiles(anyInt())).thenReturn(infos);
mController.updateDynamicRawDataToIndex(data);
assertThat(data.size()).isEqualTo(2);
}
use of com.android.settingslib.search.SearchIndexableRaw in project android_packages_apps_Settings by omnirom.
the class TrustAgentListPreferenceController method updateDynamicRawDataToIndex.
@Override
public void updateDynamicRawDataToIndex(List<SearchIndexableRaw> rawData) {
if (!isAvailable()) {
return;
}
final List<TrustAgentManager.TrustAgentComponentInfo> agents = getActiveTrustAgents(mContext);
if (agents == null) {
return;
}
for (int i = 0, size = agents.size(); i < size; i++) {
final SearchIndexableRaw raw = new SearchIndexableRaw(mContext);
final TrustAgentManager.TrustAgentComponentInfo agent = agents.get(i);
raw.key = PREF_KEY_TRUST_AGENT + i;
raw.title = agent.title;
rawData.add(raw);
}
}
use of com.android.settingslib.search.SearchIndexableRaw in project android_packages_apps_Settings by omnirom.
the class AccountPreferenceControllerTest method updateDynamicRawDataToIndex_disallowModify_shouldAddTwo.
@Test
public void updateDynamicRawDataToIndex_disallowModify_shouldAddTwo() {
final List<SearchIndexableRaw> data = new ArrayList<>();
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", UserInfo.FLAG_MANAGED_PROFILE));
when(mUserManager.isManagedProfile()).thenReturn(false);
when(mUserManager.getProfiles(anyInt())).thenReturn(infos);
when(mAccountHelper.hasBaseUserRestriction(eq(UserManager.DISALLOW_MODIFY_ACCOUNTS), anyInt())).thenReturn(true);
mController.updateDynamicRawDataToIndex(data);
assertThat(data.size()).isEqualTo(2);
}
use of com.android.settingslib.search.SearchIndexableRaw in project android_packages_apps_Settings by omnirom.
the class AccountPreferenceControllerTest method updateDynamicRawDataToIndex_enabledUser_notManagedUser_shouldNotUpdate.
@Test
public void updateDynamicRawDataToIndex_enabledUser_notManagedUser_shouldNotUpdate() {
final List<SearchIndexableRaw> data = new ArrayList<>();
final List<UserInfo> infos = new ArrayList<>();
infos.add(new UserInfo(1, "user 1", 0));
when(mUserManager.isManagedProfile()).thenReturn(false);
when(mUserManager.getProfiles(anyInt())).thenReturn(infos);
mController.updateDynamicRawDataToIndex(data);
assertThat(data.size()).isEqualTo(0);
}
Aggregations