Fix an issue where we might load bubbles with an invalid user id
The existing code that handles removing bubbles for removed users is dependent on the volatile repository having data. The volatile repository will only have data if the bubble overflow had previously been loaded. This means if you removed an account that has bubbles previously saved in XML, but hadn't received any bubbles before that (i.e. never loaded bubble overflow, volatile repository is not populated), next time you receive a bubble, we'd still try to load that bubble for an account no longer on the device. This would happen because we'd try to remove the bubble but the volatile repository wouldn't have any data so we'd never update the XML. This CL fixes this issue by passing active accounts to the overflow loading method & when it reads from disc, it'll go through the list of bubbles loaded and remove any that don't have a valid user. Then it persists that new list to disk (if anything changed). Test: atest BubbleDataRepositoryTest Test: manual - have a user with a work profile - get bubbles on the work profile, dismiss them - reboot the device - delete the work profile - get a bubble on the main user => observe that there is no crash Bug: 285409137 Change-Id: Ide5ca24e88e5e81a0a3b24cd48e2905ea1e5b28e
Loading
Please register or sign in to comment