Skip to content

Commit 43a760b

Browse files
Romain GuyAndroid (Google) Code Review
authored andcommitted
Merge "Don't crash on Surface.unlockAndPost() but log & try again Bug #6482593" into jb-dev
2 parents fb5c3db + dddcd22 commit 43a760b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

core/java/android/view/ViewRootImpl.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,7 +2257,7 @@ private boolean drawSoftware(Surface surface, AttachInfo attachInfo, int yoff,
22572257
mLayoutRequested = true; // ask wm for a new surface next time.
22582258
return false;
22592259
} catch (IllegalArgumentException e) {
2260-
Log.e(TAG, "IllegalArgumentException locking surface", e);
2260+
Log.e(TAG, "Could not lock surface", e);
22612261
// Don't assume this is due to out of memory, it could be
22622262
// something else, and if it is something else then we could
22632263
// kill stuff (or ourself) for no reason.
@@ -2343,7 +2343,14 @@ private boolean drawSoftware(Surface surface, AttachInfo attachInfo, int yoff,
23432343
unlockCanvasAndPostStartTime = System.nanoTime();
23442344
}
23452345

2346-
surface.unlockCanvasAndPost(canvas);
2346+
try {
2347+
surface.unlockCanvasAndPost(canvas);
2348+
} catch (IllegalArgumentException e) {
2349+
Log.e(TAG, "Could not unlock surface", e);
2350+
mLayoutRequested = true; // ask wm for a new surface next time.
2351+
//noinspection ReturnInsideFinallyBlock
2352+
return false;
2353+
}
23472354

23482355
if (ViewDebug.DEBUG_LATENCY) {
23492356
long now = System.nanoTime();

0 commit comments

Comments
 (0)