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

Commit d8cb837d authored by Vladimir Komsiyski's avatar Vladimir Komsiyski
Browse files

Fix the IllegalStateException problem.

RemoteCallbackList sychronizes on RemoteCallbackList.mInterfaces for the following methods:

RemoteCallbackList.register
RemoteCallbackList.unregister
RemoteCallbackList.beginBroadcast (creates a copy-on-write of the list, also under mLock)
RemoteCallbackList.finishBroadcast (clears copy-on-write of the list, also under mLock)

The last two are done under mLock. The following method doesn't need to hold RemoteCallbackList.mInterfaces because it only accesses an immutable copy of the list, not the modifiable list.

RemoteCallbackList.getBroadcastItem (reads copy-on-write array, without mLock)

The only requirement to be thread-safe with RemoteCallbackList seems to be to beginBroadcast+getBroadcastItem+finishBroadcast all in the same handler thread, so we put the beginBroadcast+getBroadcastItem+finishBroadcast into the handler to excute.

Bug: 443904984
Flag: EXEMPT bugfix
(cherry picked from https://android-review.googlesource.com/q/commit:89cf756c65a74ef92a40b6b4fe5475de3e96c4da)
Merged-In: Ifeb1fbe5bff21b0bbd7060c0ddfbbf6b5fdcb28e
Change-Id: Ifeb1fbe5bff21b0bbd7060c0ddfbbf6b5fdcb28e

ATTENTION: Conflicts occurred while applying the patch.
Please resolve conflict markers.

Change-Id: If0cda3eea9dd8657d7c51d7cb890f16669014335
parent dcbcebda
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment