Fix ConcurrentModificationException in sensor related test.

When modify a List when it is in iteration, an exception
"ConcurrentModificationException" will happen. Through method
getCollectedEvents in file TestSensorEventListener.java already
use synchronized and Collections.unmodifiableList, the List
"mCollectedEvents" still can be modified by the object itself.
Need to make a deep copy to the List instead of shollow copy.

Change-Id: Id707a674d910cb1187ae63d48e336b3ec92b02dd
Signed-off-by: Han, He <he.han@intel.com>
diff --git a/tests/tests/hardware/src/android/hardware/cts/helpers/TestSensorEventListener.java b/tests/tests/hardware/src/android/hardware/cts/helpers/TestSensorEventListener.java
index 7b1a499..662c3ce 100644
--- a/tests/tests/hardware/src/android/hardware/cts/helpers/TestSensorEventListener.java
+++ b/tests/tests/hardware/src/android/hardware/cts/helpers/TestSensorEventListener.java
@@ -49,7 +49,7 @@
     private static final long EVENT_TIMEOUT_US = TimeUnit.SECONDS.toMicros(5);
     private static final long FLUSH_TIMEOUT_US = TimeUnit.SECONDS.toMicros(10);
 
-    private final List<TestSensorEvent> mCollectedEvents = new ArrayList<>();
+    private final ArrayList<TestSensorEvent> mCollectedEvents = new ArrayList<>();
     private final List<CountDownLatch> mEventLatches = new ArrayList<>();
     private final List<CountDownLatch> mFlushLatches = new ArrayList<>();
     private final AtomicInteger mEventsReceivedOutsideHandler = new AtomicInteger();
@@ -155,7 +155,8 @@
      */
     public List<TestSensorEvent> getCollectedEvents() {
         synchronized (mCollectedEvents){
-            return Collections.unmodifiableList(mCollectedEvents);
+            List<TestSensorEvent> collectedEventsList = (List)mCollectedEvents.clone();
+            return Collections.unmodifiableList(collectedEventsList);
         }
     }