Skip to content

Commit dddcd22

Browse files
author
Romain Guy
committed
Don't crash on Surface.unlockAndPost() but log & try again
Bug #6482593 Change-Id: Ib477b58e2b7a6cb19a87d05f2aa0448e04d82f7c
1 parent f26c8be commit dddcd22

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)