Support "Add account" search indexing

Implement a default getRawDataToIndex method of preference controller
base for indexing preference's raw data.

Test: manual, robotest
Fix: 243899250
Change-Id: I3fb4f88c881edcbaa3c5bfc7f78cc2e169b0380f
This commit is contained in:
Jason Chiu
2023-12-28 18:44:26 +08:00
parent dd61b6bb3d
commit 01f992a698
3 changed files with 41 additions and 15 deletions

View File

@@ -73,7 +73,19 @@ public class BaseSearchIndexProvider implements Indexable.SearchIndexProvider {
@Override
public List<SearchIndexableRaw> getRawDataToIndex(Context context, boolean enabled) {
return null;
final List<SearchIndexableRaw> raws = new ArrayList<>();
final List<AbstractPreferenceController> controllers = getPreferenceControllers(context);
if (controllers == null || controllers.isEmpty()) {
return raws;
}
for (AbstractPreferenceController controller : controllers) {
if (controller instanceof PreferenceControllerMixin) {
((PreferenceControllerMixin) controller).updateRawDataToIndex(raws);
} else if (controller instanceof BasePreferenceController) {
((BasePreferenceController) controller).updateRawDataToIndex(raws);
}
}
return raws;
}
@Override