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

Skip to content
Commit a8b3e27e authored by Hai Zhang's avatar Hai Zhang
Browse files

Use immutable collections.

The immutable collections (under immutable/) should be used for all
data structures used in the policy classes, whereas the Android
collection helpers (under collection/) should be used in the
compatibility layer classes, and when interacting with objects
directly coming from in-process system APIs. The extension functions
for them added in this CL are more like boilterplates that we had to
add in order to make the methods calls happen on concrete classes
instead of interfaces, and to accommodate the SparseArray-like classes
that avoid autoboxing and thus can't have a uniform interface.

The access state classes have been refactored into immutable and
mutable types as well, similar to how the immutable collections
work. Thanks to the explicit mutations, manual calls to requestWrite()
is also no longer required and the compiler will ensure that we can
detect changes and know when to persist.

The policy classes are updated to follow the mutate*() pattern in
order to copy only the changing parts of the data structure. The
compatibility layer classes are updated to use the standard Android
collections directly, since it doesn't need immutability.

Some small refactoring also happened for some persistence, migration
and upgrade code, for them to be better organized/more consistent.

Bug: 182523293
Test: build
Change-Id: I2879a937ee6606a2bd0bc0c521076550ea1b058b
parent c58566fc
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