Commit 5968a00
Fix Android crash when changing shared Drawable tint on Searchbar (dotnet#33071)
App crashes because of changing a shared Drawable on the fly. I found
out it is the SearchBar. It only happens on Android and in large apps
with lots of screens. Unfortunately I can't reproduce it in the
TestSuite. But by reading the docs of Android this crash is common and
caused by changing a Drawable which is still referenced. With a custom
SearchBarHandler the issues is resolved.
```Backtrace (top frames):
#00 pc 00000000006b8694 /system/lib64/libhwui.so
android::getRootAlpha(_JNIEnv*, _jobject*, long) +4
#1 pc 0000000002256c90 /memfd:jit-cache (deleted)
art_jni_trampoline +112
#2 pc 000000000223bc4c /memfd:jit-cache (deleted)
android.graphics.drawable.VectorDrawable.-$$Nest$smnGetRootAlpha +108
#3 pc 000000000223bb20 /memfd:jit-cache (deleted)
android.graphics.drawable.VectorDrawable$VectorDrawableState.getAlpha +144
#4 pc 00000000025c50e0 /memfd:jit-cache (deleted)
android.graphics.drawable.VectorDrawable.getAlpha +128
#5 pc 00000000025c4f9c /memfd:jit-cache (deleted)
android.graphics.drawable.VectorDrawable.getOpacity +124
#6 pc 00000000025c1ea8 /memfd:jit-cache (deleted)
android.widget.ImageView.isOpaque +152
#7 pc 000000000227979c /memfd:jit-cache (deleted)
android.view.View.invalidateInternal +428
#8 pc 00000000025c4790 /memfd:jit-cache (deleted)
android.widget.ImageView.invalidateDrawable +256
#9 pc 000000000224419c /memfd:jit-cache (deleted)
android.graphics.drawable.Drawable.invalidateSelf +156
#10 pc 000000000260e710 /memfd:jit-cache (deleted)
android.graphics.drawable.VectorDrawable.setTintList +192
#11 pc 00000000025d0094 /memfd:jit-cache (deleted)
**android.graphics.drawable.Drawable.setTint +148**
```
### Description of Change
- Changes tinting of Androids SearchBar to unified setTint instead of
setColorFilter
- Mutates the drawable before setting the tint.
### Issues Fixed
Issue is fixed with a custom handler for now.
Fixes dotnet#330701 parent a7e791d commit 5968a00
1 file changed
Lines changed: 28 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
140 | 136 | | |
141 | 137 | | |
142 | 138 | | |
| |||
154 | 150 | | |
155 | 151 | | |
156 | 152 | | |
157 | | - | |
| 153 | + | |
158 | 154 | | |
159 | | - | |
| 155 | + | |
160 | 156 | | |
161 | 157 | | |
162 | 158 | | |
| |||
240 | 236 | | |
241 | 237 | | |
242 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
243 | 258 | | |
244 | | - | |
| 259 | + | |
0 commit comments