Iterate over a copy in QSTileHost#changeTiles
Prevent OOB exception when iterating over the list of previous tiles, as it could be modified. As we just need to find out what changed, there's no need to add extra locking. Test: no test Fixes: 150212857 Change-Id: I129660a81771acba3d6a5da58fb14ed19659d4ea
This commit is contained in:
@@ -326,10 +326,10 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, D
|
||||
}
|
||||
|
||||
public void changeTiles(List<String> previousTiles, List<String> newTiles) {
|
||||
final int NP = previousTiles.size();
|
||||
final int NA = newTiles.size();
|
||||
final List<String> copy = new ArrayList<>(previousTiles);
|
||||
final int NP = copy.size();
|
||||
for (int i = 0; i < NP; i++) {
|
||||
String tileSpec = previousTiles.get(i);
|
||||
String tileSpec = copy.get(i);
|
||||
if (!tileSpec.startsWith(CustomTile.PREFIX)) continue;
|
||||
if (!newTiles.contains(tileSpec)) {
|
||||
ComponentName component = CustomTile.getComponentFromSpec(tileSpec);
|
||||
|
||||
Reference in New Issue
Block a user