Fix ConcurrentModificationException in SliceBackgroundWorker
- Two different threads could call SliceBackgroundWorker.getInstance() at the same time and caused ConcurrentModificationException - Add a new API overloading getInstance for each slice to get a nullable worker since there is no result data then - Only slice provider can create a new worker instance in main thread Test: robotest Change-Id: I560529bb6034ec22263418adeb7f3ccebf879196 Fixes: 121043385
This commit is contained in:
@@ -105,8 +105,8 @@ public class WifiSlice implements CustomSliceable {
|
||||
return listBuilder.build();
|
||||
}
|
||||
|
||||
final List<AccessPoint> results =
|
||||
SliceBackgroundWorker.getInstance(mContext, this).getResults();
|
||||
final SliceBackgroundWorker worker = SliceBackgroundWorker.getInstance(getUri());
|
||||
final List<AccessPoint> results = worker != null ? worker.getResults() : null;
|
||||
|
||||
// Need a loading text when results are not ready.
|
||||
boolean needLoadingRow = results == null;
|
||||
|
Reference in New Issue
Block a user