Make ResourceIcon#get thread safe

Putting a new element in a SparseArray copies the backing array. As
ResourceIcon#get is called both from the main and BG thread, this is not
safe and sometimes leads to a bad state for ResourceIcon#ICONS. In
particular, keys would be assigned to wrong Icon, leading to QS tiles
retrieving and displaying the wrong icon.

Test: atest ResourceIconTest (it fails without the synchronize)
Test: no observable delays caused by icon updates
Fixes: 132435191

Change-Id: I9b3f535d925aa23529b59c0eacb4e67186fdabd2
2 files changed