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

Commit 083243df authored by lindatseng's avatar lindatseng Committed by Linda Tseng
Browse files

Fix panel slices title not updated when locale changed

When calling getSliceData from SliceDataConverter, we were returning
the old version of List<SliceData> if there's one already existed.
So when the Locale get changed and we are re-indexing data, we
are still inserting the old List<SliceData> in database.  We should
reconstruct the List of SliceData instead of reusing the old
version here, since we only call SliceDataConverter#getSliceData
when we need to reindex.

Test: Manual verification
Fixes: 126732022
Change-Id: I42a3cf93dc313efefe50a34faabac9e1d616ef6c
parent 0aa0d665
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -78,11 +78,8 @@ class SliceDataConverter {

    private Context mContext;

    private List<SliceData> mSliceData;

    public SliceDataConverter(Context context) {
        mContext = context;
        mSliceData = new ArrayList<>();
    }

    /**
@@ -96,9 +93,7 @@ class SliceDataConverter {
     * {@link com.android.settings.core.BasePreferenceController}.
     */
    public List<SliceData> getSliceData() {
        if (!mSliceData.isEmpty()) {
            return mSliceData;
        }
        List<SliceData> sliceData = new ArrayList<>();

        final Collection<Class> indexableClasses = FeatureFactory.getFactory(mContext)
                .getSearchFeatureProvider().getSearchIndexableResources().getProviderValues();
@@ -117,12 +112,12 @@ class SliceDataConverter {

            final List<SliceData> providerSliceData = getSliceDataFromProvider(provider,
                    fragmentName);
            mSliceData.addAll(providerSliceData);
            sliceData.addAll(providerSliceData);
        }

        final List<SliceData> a11ySliceData = getAccessibilitySliceData();
        mSliceData.addAll(a11ySliceData);
        return mSliceData;
        sliceData.addAll(a11ySliceData);
        return sliceData;
    }

    private List<SliceData> getSliceDataFromProvider(SearchIndexProvider provider,