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

Skip to content
Commit 703cf10c authored by Hui Yu's avatar Hui Yu
Browse files

Synchronize on the SparseArray object in PendingTempAllowlists.

The field mPendingTempAllowlist in PendingTempAllowlists is a
SparseArray.

In ActivityManagerService, the lock protection for PendingTempAllowlists
object is:
 @CompositeRWLock({"this", "mProcLock"})
    final PendingTempAllowlists mPendingTempAllowlist

Which means the mPendingTempAllowlist object can be read when either
"this" lock or "mProcLock" lock is held. But the read-operation of
SparseArray such as indexOfKey() and size() etc, actually mutate the
SparseArray by calling SparseArray.gc(). This makes @CompositeRWLock not
to be compatible with SparseArray.

Since we can not make SparseArray thread-safe, also we want to maintain
the semantic of @CompositeRWLock, we can make
PendingTempAllowlists thread-safe at least.

Bug: 193788840
Test: Regression test.
Change-Id: Ie1c239ad27d1fd6b76676951b470605513848b20
parent da94cf36
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment