Android SystemUI glitches in Lollipop
Setting android:hardwareAccelerated="false"
is a kind of extreme solution, as graphical performance is likely to be very bad.
If you can pinpoint the view that is misbehaving and causing this issue, a better fix would be to switch it to software rendering instead, via setLayerType()
, e.g.
view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
Funny thing is, I haven't experienced any rendering glitches with Lollipop so far, but we did see them in KITKAT (as mentioned in this question), and only when WebViews are present on the screen.
I would recommend experimenting with toggling this on different views until the problem is isolated (especially if it's easy to reproduce).
So far, every occurence of this issue has been related to WebViews (or components that use WebView, such as AdMob). According to the AOSP Issue Tracker the problem is fixed in Android 5.0, but it doesn't seem to be the case.
Android Lollipop Activity Screen corrupted
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); solves the problem.
System UI (Statusbar and Navigation Bar) render artifact
There is a known bug in WebView
(at least since KitKat) that sometimes causes these artifacts. It was filed in the Android bug tracker as this issue. Although they claim it's fixed in Android 5.0, that is not the case, though (at least from my experience) it's not quite as easy to reproduce as before.
In any case, the workaround is to use software rendering for the WebView
, via setLayerType()
:
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
Some related questions:
- Android SystemUI glitches in Lollipop
- FlipAnimation causing issue in 4.4.3
If you have a self-contained example that reproduces the bug, I would be very grateful if you could provide it to the guys at the AOSP Issue Tracker, in the link above.
Android Lollipop 5.1: Fatal signal 11 (SIGSEGV), code 2, fault addr 0x9e985ff8 in tid 4093 (RenderThread) / when using lot of nine patch graphics
So far (even in Android M) there's no bug fix for the graphics driver bug (Adreno 420), but I found a way to work around the bug. It's definitely not a long time solution, but for the moment it's just the best available to stop apps from crashing.
I reduced the number of graphics layers to a minimum (flattened many layered graphics)
I disabled GPU rendering for particular graphic layers. It slows the drawing down a bit, but not significant.
view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
Within the "software" layers, you can still set particular views to "hardware" rendering, if you need to.
view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
Related Topics
Setting Android Theme Background Color
Sqlite Simultaneous Reading and Writing
How to Download a File from a Server and Save It in Specific Folder in Sd Card in Android
Android Studio: Default Project Directory
Newer Versions of Android Studio and Only Two Drawable Directory - Drawable and Drawable-V21
How to Detect Bluetooth State Change Using a Broadcast Receiver
Fragmentactivity Cannot Be Resolved to a Type
Change Device Language via Adb
How to Fill Color in Image in Particular Area
How to Disable Dates Before Today Date in Datepickerdialog Android
How to Get Any Identifier of the Topmost Activity
How to Create Datepicker and Timepicker Dialogs in Fragment Class
Syncing Android Studio Project with Gradle Files