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

Skip to content
Commit 313f6455 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[SB][Chips] Fix Compose chips that use notification icons.

If a chip that was using a notification icon moved from the primary chip
to the secondary chip or vice versa, there were two problems:

1) Sometimes, SysUI would crash beacuse the notification icon view is
   already attached to the primary chip view, and then we tried to
   attach it to the secondary chip view without first detaching it.

2) A chip could be missing the notification icon because the
   OngoingActivityChip composable doesn't use the icon's
   AndroidView#update method to re-bind the icon if the chip is now tied
   to a different notification.

For #1, this is fixed by calling `parent.removeView` in the
OngoingActivityChip Composable.
For #2, this is mostly? fixed by using `key` when laying out the
OngoingActivityChips Composable so that the OngoingActivityChip
Composable mostly stays connected to the same notification.

I'm not sure this CL fixes all cases yet, though. I'm going to build a test
app that changes the icon while keeping the rest of the notification the
same, and we can use that to make sure all cases are handled correctly.

Fixes: 390231934
Fixes: 393456151
Bug: 364653005
Bug: 372657935

Flag: com.android.systemui.status_bar_notification_chips
Flag: com.android.systemui.status_bar_chips_modernization

Test: Post 2 promoted ongoing notifications, then dismiss one -> verify
no crash (b/390231934)
Test: Post 2 promoted ongoing notifications -> verify both chips show
the right icons
Test: Add & remove various chips -> verify the chips always show the
right icon, and SysUI never crashes

Change-Id: I3bcf409fbe43c4588bbd38c8249db80c2bfe3fd7
parent 24969842
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