[SB] Fix status bar icon when a layer-list contains some level-lists.
If an app sends a status bar icon that is a layer-list containing 1 PNG layer and 1 level-list layer: ``` <!-- status_bar_icon.xml --> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:drawable="@drawable/close_png"/> <item android:drawable="@drawable/level_example"/> </layer-list> <!-- level_example.xml --> <level-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:maxLevel="3333" android:drawable="@drawable/ic_example_low" /> <item android:maxLevel="6666" android:drawable="@drawable/ic_example_medium" /> <item android:maxLevel="10000" android:drawable="@drawable/ic_example_full" /> </level-list> ``` Then SysUI was incorrectly showing the icon with level=0 always, even if the app requests a different level via `.setSmallIcon(R.drawable.status_bar_icon, /* level= */ 7000`. This is because `DrawableSize` was scaling down the icon, and during that process it seems SysUI lost the information about which drawable to use for different levels. This CL updates `DrawableSize` to not scale down icons if the icon is a LayerDrawable whose layers are different drawable types. Fixes: 244282477 Flag: EXEMPT bugfix Test: run test app that posts a notification using status_bar_icon.xml with level=4000, verify status bar icon (and AOD icon and shelf icon) show ic_example_medium in the icon. With level=7000, verify ic_example_full is in the icon Test: verify all other notification icons work as before Test: atest DrawableSizeTest Change-Id: I9b6afd0bc223b4bde597cf5ec42078054a6b81fe
Loading
Please register or sign in to comment