Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9c5b2558 authored by Thomas Stuart's avatar Thomas Stuart Committed by Android (Google) Code Review
Browse files

Merge "Make Connection.setExtras() thread-safe" into main

parents 928742d4 26ebeb6f
Loading
Loading
Loading
Loading
+24 −23
Original line number Diff line number Diff line
@@ -3118,12 +3118,12 @@ public abstract class Connection extends Conferenceable {
     */
    public final void setExtras(@Nullable Bundle extras) {
        checkImmutable();

        synchronized (mExtrasLock) {
            // Add/replace any new or changed extras values.
            putExtras(extras);

        // If we have used "setExtras" in the past, compare the key set from the last invocation to
        // the current one and remove any keys that went away.
            // If we have used "setExtras" in the past, compare the key set from the last invocation
            // to the current one and remove any keys that went away.
            if (mPreviousExtraKeys != null) {
                List<String> toRemove = new ArrayList<String>();
                for (String oldKey : mPreviousExtraKeys) {
@@ -3136,8 +3136,8 @@ public abstract class Connection extends Conferenceable {
                }
            }

        // Track the keys the last time set called setExtras.  This way, the next time setExtras is
        // called we can see if the caller has removed any extras values.
            // Track the keys the last time set called setExtras.  This way, the next time setExtras
            // is called we can see if the caller has removed any extras values.
            if (mPreviousExtraKeys == null) {
                mPreviousExtraKeys = new ArraySet<String>();
            }
@@ -3146,6 +3146,7 @@ public abstract class Connection extends Conferenceable {
                mPreviousExtraKeys.addAll(extras.keySet());
            }
        }
    }

    /**
     * Adds some extras to this {@code Connection}.  Existing keys are replaced and new ones are