Modify getConferenceParticipants() to return copy of the conference data.
Tyler Gunn [Thu, 18 Aug 2016 19:58:26 +0000 (12:58 -0700)]
In ImsConference#updateConferenceAfterCreation, getConferenceParticipants
is called to get a copy of the CEP data.  This, however, happens on a
different thread than the update of that data.

The ImsCall#getConferenceParticipants() method already synchronizes the
return of the data on a lock which would prevent it from being updated
while the "get" method is called, however, once the reference is returned
there is no guarantee the underlying list won't be changed.

Bug: 30861872
Change-Id: I27a1aa35299d36588c73bc47710e129e5e537a6a

src/java/com/android/ims/ImsCall.java

index 7461458..b6590f8 100644 (file)
@@ -725,13 +725,13 @@ public class ImsCall implements ICall {
      * Gets the list of conference participants currently
      * associated with this call.
      *
-     * @return The list of conference participants.
+     * @return Copy of the list of conference participants.
      */
     public List<ConferenceParticipant> getConferenceParticipants() {
         synchronized(mLockObj) {
             logi("getConferenceParticipants :: mConferenceParticipants"
                     + mConferenceParticipants);
-            return mConferenceParticipants;
+            return new ArrayList<ConferenceParticipant>(mConferenceParticipants);
         }
     }