Update search index in UserSettings based on allowed user types
If USER_TYPE_FULL_RESTRICTED is disallowed, addUserPreference is renamed to only mention user. But search results still state default name "Add user or profile". This change updates this entry in the search index. Bug: 365899560 Test: atest UserSettingsTest#testGetRawDataToIndex_returnAllIndexablePreferences && atest UserSettingsTest#testGetRawDataToIndex_addRestrictedProfileAllowed_addUserTitleIsCorrect && atest UserSettingsTest#testGetRawDataToIndex_addRestrictedProfileDisallowed_addUserTitleIsCorrect Flag: EXEMPT bugfix_only Change-Id: I3c26180225491e4916141a3fca9d2e7ab36e8cfc
This commit is contained in:
@@ -1834,6 +1834,24 @@ public class UserSettings extends SettingsPreferenceFragment
|
||||
MultiUserSwitchBarController.class.getName();
|
||||
|
||||
rawData.add(allowMultipleUsersResult);
|
||||
|
||||
SearchIndexableRaw addUserData = new SearchIndexableRaw(context);
|
||||
addUserData.key = KEY_ADD_USER;
|
||||
|
||||
// Dynamically set the title of addUser preference
|
||||
final UserCapabilities userCaps = UserCapabilities.create(context);
|
||||
if (!userCaps.mCanAddRestrictedProfile) {
|
||||
addUserData.title = context.getString(
|
||||
com.android.settingslib.R.string.user_add_user);
|
||||
} else {
|
||||
addUserData.title = context.getString(
|
||||
R.string.user_add_user_or_profile_menu);
|
||||
}
|
||||
addUserData.screenTitle = context.getString(R.string.user_settings_title);
|
||||
addUserData.iconResId = R.drawable.ic_add_40dp;
|
||||
|
||||
rawData.add(addUserData);
|
||||
|
||||
return rawData;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user