add first frame callback for ams

Signed-off-by: chyyy0213 <chenhaiying3@huawei.com>
Change-Id: I94cf06ff1a5763467ccf3f8b72ea226a6f07936a
Signed-off-by: chyyy0213 <chenhaiying3@huawei.com>
This commit is contained in:
chyyy0213
2022-05-09 21:59:11 +08:00
parent 083665ce44
commit 0e6c7c978e
3 changed files with 9 additions and 1 deletions
+1
View File
@@ -117,6 +117,7 @@ void StartingWindow::HandleClientWindowCreate(sptr<WindowNode>& node, sptr<IWind
WLOGFI("Replace surfaceNode, id: %{public}u", node->GetWindowId());
node->leashWinSurfaceNode_->RemoveChild(node->startingWinSurfaceNode_);
node->leashWinSurfaceNode_->AddChild(node->surfaceNode_, -1);
AAFwk::AbilityManagerClient::GetInstance()->CompleteFirstFrameDrawing(node->abilityToken_);
RSTransaction::FlushImplicitTransaction();
};
node->surfaceNode_->SetBufferAvailableCallback(firstFrameCompleteCallback);
+1 -1
View File
@@ -1690,7 +1690,7 @@ void WindowNodeContainer::SetDisplaySize(DisplayId displayId, uint32_t width, ui
return;
}
displayInfosMap_[displayId]->SetWidth(width);
displayInfosMap_[displayId]->SetHeight(width);
displayInfosMap_[displayId]->SetHeight(height);
displayRectMap_[displayId].width_ = width;
displayRectMap_[displayId].height_ = height;
layoutPolicy_->UpdateDisplayInfo(displayRectMap_);
+7
View File
@@ -187,6 +187,13 @@ WMError WindowRoot::SaveWindow(const sptr<WindowNode>& node)
if (node->GetWindowToken()) {
AddDeathRecipient(node);
}
// Register FirstFrame Callback to rs, inform ability to get snapshot
auto firstFrameCompleteCallback = [node]() {
AAFwk::AbilityManagerClient::GetInstance()->CompleteFirstFrameDrawing(node->abilityToken_);
};
if (node->surfaceNode_ && WindowHelper::IsMainWindow(node->GetWindowType())) {
node->surfaceNode_->SetBufferAvailableCallback(firstFrameCompleteCallback);
}
return WMError::WM_OK;
}