diff --git a/wmserver/include/window_node.h b/wmserver/include/window_node.h index 4cf5695b3482db85cd9dddfaa59397bf047632cd..52ec3e91595e78757134b8772d0a652cfe455b2f 100644 --- a/wmserver/include/window_node.h +++ b/wmserver/include/window_node.h @@ -144,7 +144,7 @@ public: bool isPlayAnimationShow_ { false }; // delete when enable state machine bool isPlayAnimationHide_ { false }; // delete when enable state machine bool startingWindowShown_ { false }; - bool firstFrameAvaliable_ { false }; + bool firstFrameAvailable_ { false }; bool isShowingOnMultiDisplays_ { false }; std::vector showingDisplays_; AbilityInfo abilityInfo_; diff --git a/wmserver/src/remote_animation.cpp b/wmserver/src/remote_animation.cpp index e31934eed164b501f0cd3f04488d106298b9525d..8222b39674d0b9ec8827761bfd6aa09f288004b2 100644 --- a/wmserver/src/remote_animation.cpp +++ b/wmserver/src/remote_animation.cpp @@ -163,7 +163,7 @@ static void GetAndDrawSnapShot(const sptr& srcNode) WLOGFD("srcNode or srcNode->leashWinSurfaceNode_ is empty"); return; } - if (srcNode->firstFrameAvaliable_) { + if (srcNode->firstFrameAvailable_) { std::shared_ptr pixelMap; bool snapSucc = SurfaceDraw::GetSurfaceSnapshot(srcNode->surfaceNode_, pixelMap, SNAPSHOT_TIMEOUT_MS, 1.0, 1.0); if (!snapSucc) { diff --git a/wmserver/src/starting_window.cpp b/wmserver/src/starting_window.cpp index 889d96321c8f29d4fbfd52ff778d20553958756c..352aaaaa06cf7fcf967986296b896ea5889026d7 100644 --- a/wmserver/src/starting_window.cpp +++ b/wmserver/src/starting_window.cpp @@ -160,7 +160,7 @@ void StartingWindow::HandleClientWindowCreate(sptr& node, sptrleashWinSurfaceNode_->RemoveChild(weakNode->startingWinSurfaceNode_); WindowInnerManager::GetInstance().CompleteFirstFrameDrawing(weakNode); RSTransaction::FlushImplicitTransaction(); - weakNode->firstFrameAvaliable_ = true; + weakNode->firstFrameAvailable_ = true; weakNode->startingWinSurfaceNode_ = nullptr; }; node->surfaceNode_->SetBufferAvailableCallback(firstFrameCompleteCallback); diff --git a/wmserver/src/window_dumper.cpp b/wmserver/src/window_dumper.cpp index ad8aaa07d40fb3fe738c3366fd2fe3e55b428513..a6bcc390eaf5f87d7f25309d9cc19cd0ad22bb8f 100644 --- a/wmserver/src/window_dumper.cpp +++ b/wmserver/src/window_dumper.cpp @@ -187,7 +187,7 @@ WMError WindowDumper::DumpSpecifiedWindowInfo(uint32_t windowId, const std::vect oss << "Flag: " << node->GetWindowFlags() << std::endl; oss << "Orientation: " << static_cast(node->GetRequestedOrientation()) << std::endl; oss << "IsStartingWindow: " << isShown_ << std::endl; - oss << "FirstFrameCallbackCalled: " << node->firstFrameAvaliable_ << std::endl; + oss << "FirstFrameCallbackCalled: " << node->firstFrameAvailable_ << std::endl; oss << "IsVisible: " << isVisible << std::endl; oss << "WindowRect: " << "[ " << rect.posX_ << ", " << rect.posY_ << ", " << rect.width_ << ", " << rect.height_ diff --git a/wmserver/src/window_snapshot/snapshot_controller.cpp b/wmserver/src/window_snapshot/snapshot_controller.cpp index bde6ea8571618f2a391f80a7e0ab8ccb846b22de..9bfab212c074471aa3edd7a03e722a092d32868f 100644 --- a/wmserver/src/window_snapshot/snapshot_controller.cpp +++ b/wmserver/src/window_snapshot/snapshot_controller.cpp @@ -49,7 +49,11 @@ int32_t SnapshotController::GetSnapshot(const sptr &token, Snapsh if (targetNode != nullptr) { pixelMap = targetNode->GetSnapshot(); targetNode->SetSnapshot(nullptr); // reset window snapshot after use - surfaceNode = targetNode->surfaceNode_; + if (targetNode->surfaceNode_ && targetNode->firstFrameAvailable_) { + surfaceNode = targetNode->surfaceNode_; + } else { + surfaceNode = targetNode->startingWinSurfaceNode_; + } } }; handler_->PostSyncTask(task, AppExecFwk::EventQueue::Priority::IMMEDIATE); diff --git a/wmserver/test/unittest/remote_animation_test.cpp b/wmserver/test/unittest/remote_animation_test.cpp index 27af9854ea6193a0dc7ed42f762335be826d17e9..ea18c9f2de3ad89d2131a61c7ad4d5543ed7e5ec 100644 --- a/wmserver/test/unittest/remote_animation_test.cpp +++ b/wmserver/test/unittest/remote_animation_test.cpp @@ -444,19 +444,19 @@ HWTEST_F(RemoteAnimationTest, CreateHideAnimationFinishedCallback02, Function | finishCallback->OnAnimationFinished(); // with minimize usleep(SLEEP_TIME_IN_US); - node_->firstFrameAvaliable_ = true; + node_->firstFrameAvailable_ = true; finishCallback = RemoteAnimation::CreateHideAnimationFinishedCallback(node_, TransitionEvent::CLOSE); EXPECT_NE(nullptr, finishCallback); - finishCallback->OnAnimationFinished(); // create hide callback with firstFrameAvaliable_ true + finishCallback->OnAnimationFinished(); // create hide callback with firstFrameAvailable_ true usleep(SLEEP_TIME_IN_US); - node_->firstFrameAvaliable_ = false; + node_->firstFrameAvailable_ = false; finishCallback = RemoteAnimation::CreateHideAnimationFinishedCallback(node_, TransitionEvent::CLOSE); EXPECT_NE(nullptr, finishCallback); finishCallback->OnAnimationFinished(); // create hide callback with surfaceNode null usleep(SLEEP_TIME_IN_US); - node_->firstFrameAvaliable_ = false; + node_->firstFrameAvailable_ = false; node_->surfaceNode_ = CreateRSSurfaceNode(1); finishCallback = RemoteAnimation::CreateHideAnimationFinishedCallback(node_, TransitionEvent::CLOSE); EXPECT_NE(nullptr, finishCallback);