summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchaviw <chaviw@google.com>2020-04-30 12:14:35 -0700
committerchaviw <chaviw@google.com>2020-04-30 14:38:52 -0700
commit5fc80e7b32a00b4e43b4ce13d60bd82796130182 (patch)
treeb55f655f1a74a0a0bb995a5487a48f27815c050a
parent8e47f58e6bbeaa3f3f75d88562e7849202beea51 (diff)
Send drawFinish callback even if did not draw
There are cases where ViewRootImpl requests to draw, but there was nothing new to draw. In that case, the callback will never be invoked and ViewRootImpl will wait forever. This change will invoke the callback even if there is nothing to draw. It will use the last frameNumber since nothing new has drawn Test: Request draw with nothing new. Callback is invoked Fixes: 155429223 Change-Id: I7c9ed7fd63a451b17133a11ffbcf8fb64be558e5
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index c19b1878ad45..335bcdcfc1fb 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -440,6 +440,12 @@ void CanvasContext::draw() {
if (dirty.isEmpty() && Properties::skipEmptyFrames && !surfaceRequiresRedraw()) {
mCurrentFrameInfo->addFlag(FrameInfoFlags::SkippedFrame);
+ // Notify the callbacks, even if there's nothing to draw so they aren't waiting
+ // indefinitely
+ for (auto& func : mFrameCompleteCallbacks) {
+ std::invoke(func, mFrameNumber);
+ }
+ mFrameCompleteCallbacks.clear();
return;
}