Skip to content

Commit d44a168

Browse files
Romain GuyAndroid (Google) Code Review
authored andcommitted
Merge "Don't draw onto a hw surface using the software renderer Bug #6485955" into jb-dev
2 parents 67d10a5 + 413baf8 commit d44a168

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

core/java/android/view/ViewRootImpl.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,6 +2183,18 @@ private void draw(boolean fullRedrawNeeded) {
21832183
private boolean drawSoftware(Surface surface, AttachInfo attachInfo, int yoff,
21842184
boolean scalingRequired, Rect dirty) {
21852185

2186+
// If we get here with a disabled & requested hardware renderer, something went
2187+
// wrong (an invalidate posted right before we destroyed the hardware surface
2188+
// for instance) so we should just bail out. Locking the surface with software
2189+
// rendering at this point would lock it forever and prevent hardware renderer
2190+
// from doing its job when it comes back.
2191+
if (attachInfo.mHardwareRenderer != null && !attachInfo.mHardwareRenderer.isEnabled() &&
2192+
attachInfo.mHardwareRenderer.isRequested()) {
2193+
mFullRedrawNeeded = true;
2194+
scheduleTraversals();
2195+
return false;
2196+
}
2197+
21862198
// Draw with software renderer.
21872199
Canvas canvas;
21882200
try {

0 commit comments

Comments
 (0)