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

Skip to content
Commit 3a69c3a3 authored by Stevie Kideckel's avatar Stevie Kideckel
Browse files

Optimize parcelization protocol in RemoteViews and RemoteCollectionItems

By using "squashing", each ApplicationInfo is only written to the parcel
once. Subsequent writes write only a single int as a reference.

This makes the earlier system with ELIDE_DUPLICATES unnecessary.

Squashing relies on testing for equality, and ApplicationInfo does not
implement equals, therefore I've added a shared cache based on package
name and uid so that we can force all RemoteViews of the same package to
use the same ApplicationInfo object.

There is also a mechanism to update the ApplicationInfo to a new one
(needed for dynamic colors).

This saves space for addView calls as well as RemoteCollectionItems
usage. After this change, each incremental item in a collection adds 48
bytes as a base (before this was multiple kilobytes).

This approach also supports collections with RemoteViews from multiple
packages. Each ApplicationInfo in the entire hierarchy is written at
most once.

Bug: 202831917
Test: locally, atest RemoteViewsTest, atest RemoteViewsFixedCollectionAdapterTest
Change-Id: Ie1b1dc8760247aa771451149243efd63d36da368
parent 5170817d
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