Avoid race condition with hotseat predictions.
Make sure that the ArrayList cannot be cleared on the model thread while it is being used on the UI thread to render a launcher preview. Test: Manual Fix: 210123588 Change-Id: I5a47cb3f28f5ac9e400f6ae535e410c345e14ee1
This commit is contained in:
@@ -59,8 +59,8 @@ public final class WidgetsPredictionUpdateTask extends BaseModelUpdateTask {
|
||||
Map<PackageUserKey, List<WidgetItem>> allWidgets =
|
||||
dataModel.widgetsModel.getAllWidgetsWithoutShortcuts();
|
||||
|
||||
FixedContainerItems fixedContainerItems = mPredictorState.items;
|
||||
fixedContainerItems.items.clear();
|
||||
FixedContainerItems fixedContainerItems =
|
||||
new FixedContainerItems(mPredictorState.containerId);
|
||||
|
||||
if (FeatureFlags.ENABLE_LOCAL_RECOMMENDED_WIDGETS_FILTER.get()) {
|
||||
for (AppTarget app : mTargets) {
|
||||
@@ -100,6 +100,7 @@ public final class WidgetsPredictionUpdateTask extends BaseModelUpdateTask {
|
||||
}
|
||||
}
|
||||
}
|
||||
dataModel.extraItems.put(mPredictorState.containerId, fixedContainerItems);
|
||||
bindExtraContainerItems(fixedContainerItems);
|
||||
|
||||
// Don't store widgets prediction to disk because it is not used frequently.
|
||||
|
||||
Reference in New Issue
Block a user