From aa95a88327d9a3ac8a4a00b065b78ac0f28b3a19 Mon Sep 17 00:00:00 2001 From: John Reck Date: Fri, 7 Nov 2014 11:02:07 -0800 Subject: Have an actual fallback if the surface is lost Bug: 17516789 This will force a relayout/reinitialize pass if the Surface is lost mid-render instead of crashing on the next frame Change-Id: If08bfa16f740728fa7c05904fa11e26f07b81e2e --- libs/hwui/renderthread/CanvasContext.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libs/hwui/renderthread/CanvasContext.cpp') diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index b499dd0..6c3637d 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -166,6 +166,11 @@ void CanvasContext::prepareTree(TreeInfo& info) { freePrefetechedLayers(); } + if (CC_UNLIKELY(!mNativeWindow.get())) { + info.out.canDrawThisFrame = false; + return; + } + int runningBehind = 0; // TODO: This query is moderately expensive, investigate adding some sort // of fast-path based off when we last called eglSwapBuffers() as well as -- cgit v1.1