use of com.android.settings.search.SearchFeatureProviderImpl in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SlicesDatabaseAccessorTest method getSliceKeys_indexesDatabase.
@Test
@Config(qualifiers = "mcc999")
public void getSliceKeys_indexesDatabase() {
// Force new indexing
Locale.setDefault(new Locale("ca"));
final SearchFeatureProvider provider = new SearchFeatureProviderImpl();
final SlicesFeatureProvider sliceProvider = spy(new SlicesFeatureProviderImpl());
final FakeFeatureFactory factory = FakeFeatureFactory.setupForTest();
factory.searchFeatureProvider = provider;
factory.slicesFeatureProvider = sliceProvider;
// Fake the indexable list.
provider.getSearchIndexableResources().getProviderValues().clear();
provider.getSearchIndexableResources().getProviderValues().add(FakeIndexProvider.class);
final SlicesDatabaseAccessor accessor = new SlicesDatabaseAccessor(mContext);
final List<String> keys = accessor.getSliceKeys(true);
assertThat(keys).isNotEmpty();
}
use of com.android.settings.search.SearchFeatureProviderImpl in project android_packages_apps_Settings by DirtyUnicorns.
the class AccountPreferenceController method updateProfileUi.
private void updateProfileUi(final UserInfo userInfo) {
if (mParent.getPreferenceManager() == null) {
return;
}
final ProfileData data = mProfiles.get(userInfo.id);
if (data != null) {
data.pendingRemoval = false;
if (userInfo.isEnabled()) {
// recreate the authentication helper to refresh the list of enabled accounts
data.authenticatorHelper = new AuthenticatorHelper(mContext, userInfo.getUserHandle(), this);
}
return;
}
final Context context = mContext;
final ProfileData profileData = new ProfileData();
profileData.userInfo = userInfo;
AccessiblePreferenceCategory preferenceGroup = mHelper.createAccessiblePreferenceCategory(mParent.getPreferenceManager().getContext());
preferenceGroup.setOrder(mAccountProfileOrder++);
if (isSingleProfile()) {
preferenceGroup.setTitle(context.getString(R.string.account_for_section_header, userInfo.name));
preferenceGroup.setContentDescription(mContext.getString(R.string.account_settings));
} else if (userInfo.isManagedProfile()) {
preferenceGroup.setTitle(R.string.category_work);
String workGroupSummary = getWorkGroupSummary(context, userInfo);
preferenceGroup.setSummary(workGroupSummary);
preferenceGroup.setContentDescription(mContext.getString(R.string.accessibility_category_work, workGroupSummary));
profileData.removeWorkProfilePreference = newRemoveWorkProfilePreference(context);
mHelper.enforceRestrictionOnPreference(profileData.removeWorkProfilePreference, DISALLOW_REMOVE_MANAGED_PROFILE, UserHandle.myUserId());
profileData.managedProfilePreference = newManagedProfileSettings();
} else {
preferenceGroup.setTitle(R.string.category_personal);
preferenceGroup.setContentDescription(mContext.getString(R.string.accessibility_category_personal));
}
final PreferenceScreen screen = mParent.getPreferenceScreen();
if (screen != null) {
screen.addPreference(preferenceGroup);
}
profileData.preferenceGroup = preferenceGroup;
if (userInfo.isEnabled()) {
profileData.authenticatorHelper = new AuthenticatorHelper(context, userInfo.getUserHandle(), this);
profileData.addAccountPreference = newAddAccountPreference(context);
mHelper.enforceRestrictionOnPreference(profileData.addAccountPreference, DISALLOW_MODIFY_ACCOUNTS, userInfo.id);
}
mProfiles.put(userInfo.id, profileData);
new SearchFeatureProviderImpl().getIndexingManager(mContext).updateFromClassNameResource(UserAndAccountDashboardFragment.class.getName(), true);
}
use of com.android.settings.search.SearchFeatureProviderImpl in project android_packages_apps_Settings by crdroidandroid.
the class AccountPreferenceController method updateProfileUi.
private void updateProfileUi(final UserInfo userInfo) {
if (mParent.getPreferenceManager() == null) {
return;
}
final ProfileData data = mProfiles.get(userInfo.id);
if (data != null) {
data.pendingRemoval = false;
if (userInfo.isEnabled()) {
// recreate the authentication helper to refresh the list of enabled accounts
data.authenticatorHelper = new AuthenticatorHelper(mContext, userInfo.getUserHandle(), this);
}
return;
}
final Context context = mContext;
final ProfileData profileData = new ProfileData();
profileData.userInfo = userInfo;
AccessiblePreferenceCategory preferenceGroup = mHelper.createAccessiblePreferenceCategory(mParent.getPreferenceManager().getContext());
preferenceGroup.setOrder(mAccountProfileOrder++);
if (isSingleProfile()) {
preferenceGroup.setTitle(context.getString(R.string.account_for_section_header, userInfo.name));
preferenceGroup.setContentDescription(mContext.getString(R.string.account_settings));
} else if (userInfo.isManagedProfile()) {
preferenceGroup.setTitle(R.string.category_work);
String workGroupSummary = getWorkGroupSummary(context, userInfo);
preferenceGroup.setSummary(workGroupSummary);
preferenceGroup.setContentDescription(mContext.getString(R.string.accessibility_category_work, workGroupSummary));
profileData.removeWorkProfilePreference = newRemoveWorkProfilePreference(context);
mHelper.enforceRestrictionOnPreference(profileData.removeWorkProfilePreference, DISALLOW_REMOVE_MANAGED_PROFILE, UserHandle.myUserId());
profileData.managedProfilePreference = newManagedProfileSettings();
} else {
preferenceGroup.setTitle(R.string.category_personal);
preferenceGroup.setContentDescription(mContext.getString(R.string.accessibility_category_personal));
}
final PreferenceScreen screen = mParent.getPreferenceScreen();
if (screen != null) {
screen.addPreference(preferenceGroup);
}
profileData.preferenceGroup = preferenceGroup;
if (userInfo.isEnabled()) {
profileData.authenticatorHelper = new AuthenticatorHelper(context, userInfo.getUserHandle(), this);
profileData.addAccountPreference = newAddAccountPreference(context);
mHelper.enforceRestrictionOnPreference(profileData.addAccountPreference, DISALLOW_MODIFY_ACCOUNTS, userInfo.id);
}
mProfiles.put(userInfo.id, profileData);
new SearchFeatureProviderImpl().getIndexingManager(mContext).updateFromClassNameResource(UserAndAccountDashboardFragment.class.getName(), true);
}
use of com.android.settings.search.SearchFeatureProviderImpl in project platform_packages_apps_Settings by BlissRoms.
the class AccountPreferenceController method updateProfileUi.
private void updateProfileUi(final UserInfo userInfo) {
if (mParent.getPreferenceManager() == null) {
return;
}
final ProfileData data = mProfiles.get(userInfo.id);
if (data != null) {
data.pendingRemoval = false;
if (userInfo.isEnabled()) {
// recreate the authentication helper to refresh the list of enabled accounts
data.authenticatorHelper = new AuthenticatorHelper(mContext, userInfo.getUserHandle(), this);
}
return;
}
final Context context = mContext;
final ProfileData profileData = new ProfileData();
profileData.userInfo = userInfo;
AccessiblePreferenceCategory preferenceGroup = mHelper.createAccessiblePreferenceCategory(mParent.getPreferenceManager().getContext());
preferenceGroup.setOrder(mAccountProfileOrder++);
if (isSingleProfile()) {
preferenceGroup.setTitle(context.getString(R.string.account_for_section_header, userInfo.name));
preferenceGroup.setContentDescription(mContext.getString(R.string.account_settings));
} else if (userInfo.isManagedProfile()) {
preferenceGroup.setTitle(R.string.category_work);
String workGroupSummary = getWorkGroupSummary(context, userInfo);
preferenceGroup.setSummary(workGroupSummary);
preferenceGroup.setContentDescription(mContext.getString(R.string.accessibility_category_work, workGroupSummary));
profileData.removeWorkProfilePreference = newRemoveWorkProfilePreference(context);
mHelper.enforceRestrictionOnPreference(profileData.removeWorkProfilePreference, DISALLOW_REMOVE_MANAGED_PROFILE, UserHandle.myUserId());
profileData.managedProfilePreference = newManagedProfileSettings();
} else {
preferenceGroup.setTitle(R.string.category_personal);
preferenceGroup.setContentDescription(mContext.getString(R.string.accessibility_category_personal));
}
final PreferenceScreen screen = mParent.getPreferenceScreen();
if (screen != null) {
screen.addPreference(preferenceGroup);
}
profileData.preferenceGroup = preferenceGroup;
if (userInfo.isEnabled()) {
profileData.authenticatorHelper = new AuthenticatorHelper(context, userInfo.getUserHandle(), this);
profileData.addAccountPreference = newAddAccountPreference(context);
mHelper.enforceRestrictionOnPreference(profileData.addAccountPreference, DISALLOW_MODIFY_ACCOUNTS, userInfo.id);
}
mProfiles.put(userInfo.id, profileData);
new SearchFeatureProviderImpl().getIndexingManager(mContext).updateFromClassNameResource(UserAndAccountDashboardFragment.class.getName(), true);
}
use of com.android.settings.search.SearchFeatureProviderImpl in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SliceDataConverterTest method setUp.
@Before
public void setUp() {
mContext = RuntimeEnvironment.application;
mSliceDataConverter = spy(new SliceDataConverter(RuntimeEnvironment.application));
mSearchFeatureProvider = new SearchFeatureProviderImpl();
mFakeFeatureFactory = FakeFeatureFactory.setupForTest();
mFakeFeatureFactory.searchFeatureProvider = mSearchFeatureProvider;
}
Aggregations