Fix for location test ConcurrentModificationException issue
android.location.cts.GnssNavigationMessageRegistrationTest
is failing due to java.util.ConcurrentModificationException.
Use CopyOnWriteArrayList instead of ArrayList to avoid it.
Change-Id: Id9947be2c9bdd9f4c3cacb05c08b15885dd602bc
diff --git a/tests/tests/location/src/android/location/cts/TestGnssNavigationMessageListener.java b/tests/tests/location/src/android/location/cts/TestGnssNavigationMessageListener.java
index 068c4cb..a2f12de 100644
--- a/tests/tests/location/src/android/location/cts/TestGnssNavigationMessageListener.java
+++ b/tests/tests/location/src/android/location/cts/TestGnssNavigationMessageListener.java
@@ -21,8 +21,8 @@
import android.location.GnssNavigationMessage;
import android.util.Log;
-import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -45,7 +45,7 @@
mTag = tag;
mCountDownLatch = new CountDownLatch(1);
mEventsToCollect = eventsToCollect;
- mEvents = new ArrayList<>(eventsToCollect);
+ mEvents = new CopyOnWriteArrayList<GnssNavigationMessage>();
}
@Override