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

Skip to content
Commit fb4b51c5 authored by Coco Duan's avatar Coco Duan
Browse files

Fix NPE when removing widgets

The issue happened when removing a user-selected widget, as
`deleteWidget()` handles removing from both DB and AppWidgetHost.
Then `onAppWidgetRemoved()` callback repetitively calls
`deleteWidget()` trying to remove from DB and widget host again.

- Separate the call to delete a widget from widget host and DB.
  Let CommunalAppWidgetHost manages deleting from DB for both
  uninstalled or user-selected widget, following the deletion
  from widget host.
- In CommunalWidgetDAO#deleteWidgetById, added a null check on
  the entry that is queried. Returns false if no entry exists
  to be deleted.

Bug: b/323057545
Test: atest CommunalWidgetRepositoryImplTest
Test: atest CommunalWidgetDaoTest
Test: atest CommunalEditModeViewModelTest
Flag: ACONFIG com.android.systemui.communal_hub DEVELOPMENT
Change-Id: I6a9b8f8605f22b08a447acf8d7747519fc6e3f81
parent 5ed53c5f
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