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
This commit is contained in:
@@ -78,11 +78,8 @@ class SliceDataConverter {
|
|||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
private List<SliceData> mSliceData;
|
|
||||||
|
|
||||||
public SliceDataConverter(Context context) {
|
public SliceDataConverter(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mSliceData = new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,9 +93,7 @@ class SliceDataConverter {
|
|||||||
* {@link com.android.settings.core.BasePreferenceController}.
|
* {@link com.android.settings.core.BasePreferenceController}.
|
||||||
*/
|
*/
|
||||||
public List<SliceData> getSliceData() {
|
public List<SliceData> getSliceData() {
|
||||||
if (!mSliceData.isEmpty()) {
|
List<SliceData> sliceData = new ArrayList<>();
|
||||||
return mSliceData;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Collection<Class> indexableClasses = FeatureFactory.getFactory(mContext)
|
final Collection<Class> indexableClasses = FeatureFactory.getFactory(mContext)
|
||||||
.getSearchFeatureProvider().getSearchIndexableResources().getProviderValues();
|
.getSearchFeatureProvider().getSearchIndexableResources().getProviderValues();
|
||||||
@@ -117,12 +112,12 @@ class SliceDataConverter {
|
|||||||
|
|
||||||
final List<SliceData> providerSliceData = getSliceDataFromProvider(provider,
|
final List<SliceData> providerSliceData = getSliceDataFromProvider(provider,
|
||||||
fragmentName);
|
fragmentName);
|
||||||
mSliceData.addAll(providerSliceData);
|
sliceData.addAll(providerSliceData);
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<SliceData> a11ySliceData = getAccessibilitySliceData();
|
final List<SliceData> a11ySliceData = getAccessibilitySliceData();
|
||||||
mSliceData.addAll(a11ySliceData);
|
sliceData.addAll(a11ySliceData);
|
||||||
return mSliceData;
|
return sliceData;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<SliceData> getSliceDataFromProvider(SearchIndexProvider provider,
|
private List<SliceData> getSliceDataFromProvider(SearchIndexProvider provider,
|
||||||
|
Reference in New Issue
Block a user