Add a back-up icon resource to icon-less Slices
Currently, when a Settings Slice dosen't have an icon, we add an IconCompat
object with the resource 0x0 - which gives an empty icon. This is from the UX
direction that we should only have icons for Settings Slices when the
corresponding Settings have icons in the Settings UI.
However, this causes an issue with a recent change to SliceView, which crashes
the UI when a Slice is rendered without an icon. Previously, the icon code path
was only exercised when the Slice Shortcut view was being used, but after the
change, the icon path is always used and thus crashes when trying to fetch a
resource with id 0x0 from Settings or another provider.
About 2/3rds of Settings Slices do not have icons.
This change adds the Settings App icon as the back-up icon for any Slice which
would otherwise not have an icon.
The impact of missing this change is:
- Settings Slices cannot be shown in launcher spaces until a post-P update comes
from the support library.
- If Settings launches with the bug, Slices cannot patch the API which would require
all Slices to have a non empty icon (b/111438616)
Bug: 111082093
Test: Robotests, Settings Search UI testing, Slice browser testing
Change-Id: I6f326b6b41bf59011a211c6340dd639f68e754e1
2 files changed