Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ec0410e authored by Tsung-Mao Fang's avatar Tsung-Mao Fang
Browse files

Prevent failed dynamic index

In the original design, if a controller in page initializes
failed, then it will impact all the dynamic index mechanism.

In this change, we will only skip controllers in a specfic page.
All other pages which controllers initialize correctly should work
proerly.

Test: See correct dynamic result
Bug: 185325344
Change-Id: I4f959a23635739e1064318ccdddd6d97016dac23
parent 8d8877b6
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -128,8 +128,13 @@ public class BaseSearchIndexProvider implements Indexable.SearchIndexProvider {
    }

    public List<AbstractPreferenceController> getPreferenceControllers(Context context) {
        final List<AbstractPreferenceController> controllersFromCode =
                createPreferenceControllers(context);
        List<AbstractPreferenceController> controllersFromCode = new ArrayList<>();
        try {
            controllersFromCode = createPreferenceControllers(context);
        } catch (Exception e) {
            Log.w(TAG, "Error initial controller");
        }

        final List<SearchIndexableResource> res = getXmlResourcesToIndex(context, true);
        if (res == null || res.isEmpty()) {
            return controllersFromCode;