material-components-android
material-components-android copied to clipboard
[Internal] Add constant state support to ScaledDrawableWrapper
On API < 23, the DrawableUtils.compositeTwoLayeredDrawable method can return a LayerDrawable with a child ScaledDrawable. Calling mutate() on such a LayerDrawable throws NPE because the ScaledDrawable doesn't support constant state (was fixed only in API 24, commit).
This PR adds constant state support to ScaledDrawableWrapper, thus preventing NPE on older devices.
Fixes https://github.com/material-components/material-components-android/issues/4129.
⚠️ Bump ⚠️
Besides fixing a potential crash, this PR also unlocks the ability to create another PR that fixes the incorrect implementation of the DrawableUtils.compositeTwoLayeredDrawable method.
Thank you for the PR! It's being synced in internally and will be synced out here soon, apologies for the delay