Declare "searchable" attribute for preferences.

Now we can easily mark a preference nonIndexable in xml instead of
adding key into searchIndexProvider.

Bug: 112608186
Test: robotests
Change-Id: I0ff16d44bb7b6ad148d3d35f09ca0da0163f73f4
This commit is contained in:
Fan Zhang
2018-08-14 16:25:54 -07:00
parent 097cfa7251
commit a79c377fbc
28 changed files with 201 additions and 148 deletions

View File

@@ -49,6 +49,13 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.SimpleAdapter;
import androidx.annotation.VisibleForTesting;
import androidx.annotation.WorkerThread;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference;
import androidx.preference.PreferenceGroup;
import androidx.preference.PreferenceScreen;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.util.UserIcons;
import com.android.internal.widget.LockPatternUtils;
@@ -76,13 +83,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import androidx.annotation.VisibleForTesting;
import androidx.annotation.WorkerThread;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference;
import androidx.preference.PreferenceGroup;
import androidx.preference.PreferenceScreen;
/**
* Screen that manages the list of users on the device.
* Guest user is an always visible entry, even if the guest is not currently
@@ -635,8 +635,8 @@ public class UserSettings extends SettingsPreferenceFragment
AlertDialog.Builder builder = new AlertDialog.Builder(context);
SimpleAdapter adapter = new SimpleAdapter(builder.getContext(),
data, R.layout.two_line_list_item,
new String[] {KEY_TITLE, KEY_SUMMARY},
new int[] {R.id.title, R.id.summary});
new String[]{KEY_TITLE, KEY_SUMMARY},
new int[]{R.id.title, R.id.summary});
builder.setTitle(R.string.user_add_user_type_title);
builder.setAdapter(adapter,
new DialogInterface.OnClickListener() {
@@ -1238,8 +1238,10 @@ public class UserSettings extends SettingsPreferenceFragment
}
@Override
public List<String> getNonIndexableKeysFromXml(Context context, int xmlResId) {
final List<String> niks = super.getNonIndexableKeysFromXml(context, xmlResId);
public List<String> getNonIndexableKeysFromXml(Context context, int xmlResId,
boolean suppressAllPage) {
final List<String> niks = super.getNonIndexableKeysFromXml(context, xmlResId,
suppressAllPage);
new AddUserWhenLockedPreferenceController(context, KEY_ADD_USER_WHEN_LOCKED)
.updateNonIndexableKeys(niks);
new AutoSyncDataPreferenceController(context, null /* parent */)