Loading packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java +1 −0 Original line number Diff line number Diff line Loading @@ -327,6 +327,7 @@ public class CustomTile extends QSTileImpl<State> implements TileChangeListener final Drawable drawableF = drawable; state.iconSupplier = () -> { if (drawableF == null) return null; Drawable.ConstantState cs = drawableF.getConstantState(); if (cs != null) { return new DrawableIcon(cs.newDrawable()); Loading packages/SystemUI/tests/src/com/android/systemui/qs/external/CustomTileTest.kt +8 −0 Original line number Diff line number Diff line Loading @@ -125,4 +125,12 @@ class CustomTileTest : SysuiTestCase() { customTile.handleUpdateState(state, null) assertFalse(state.value) } @Test fun testNoCrashOnNullDrawable() { customTile.qsTile.icon = mock(Icon::class.java) `when`(customTile.qsTile.icon.loadDrawable(any(Context::class.java))) .thenReturn(null) customTile.handleUpdateState(customTile.newTileState(), null) } } No newline at end of file Loading
packages/SystemUI/src/com/android/systemui/qs/external/CustomTile.java +1 −0 Original line number Diff line number Diff line Loading @@ -327,6 +327,7 @@ public class CustomTile extends QSTileImpl<State> implements TileChangeListener final Drawable drawableF = drawable; state.iconSupplier = () -> { if (drawableF == null) return null; Drawable.ConstantState cs = drawableF.getConstantState(); if (cs != null) { return new DrawableIcon(cs.newDrawable()); Loading
packages/SystemUI/tests/src/com/android/systemui/qs/external/CustomTileTest.kt +8 −0 Original line number Diff line number Diff line Loading @@ -125,4 +125,12 @@ class CustomTileTest : SysuiTestCase() { customTile.handleUpdateState(state, null) assertFalse(state.value) } @Test fun testNoCrashOnNullDrawable() { customTile.qsTile.icon = mock(Icon::class.java) `when`(customTile.qsTile.icon.loadDrawable(any(Context::class.java))) .thenReturn(null) customTile.handleUpdateState(customTile.newTileState(), null) } } No newline at end of file