!10569 可见性上报修改

Merge pull request !10569 from zzz/cherry-pick-1730962431
This commit is contained in:
openharmony_ci 2024-11-07 08:25:34 +00:00 committed by Gitee
commit 4654c86a82
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 12 additions and 3 deletions

View File

@ -7687,9 +7687,10 @@ std::vector<std::pair<uint64_t, WindowVisibilityState>> SceneSessionManager::Get
if (lastVisibleData_[i].first < currVisibleData[j].first) {
visibilityChangeInfo.emplace_back(lastVisibleData_[i].first, WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION);
i++;
} else if (lastVisibleData_[i].first > currVisibleData[j].first &&
currVisibleData[j].second != WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION) {
visibilityChangeInfo.emplace_back(currVisibleData[j].first, currVisibleData[j].second);
} else if (lastVisibleData_[i].first > currVisibleData[j].first) {
if (currVisibleData[j].second != WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION) {
visibilityChangeInfo.emplace_back(currVisibleData[j].first, currVisibleData[j].second);
}
j++;
} else {
if (lastVisibleData_[i].second != currVisibleData[j].second) {

View File

@ -233,6 +233,14 @@ HWTEST_F(SceneSessionManagerTest6, GetWindowVisibilityChangeInfo03, Function | S
std::make_pair(2, WindowVisibilityState::WINDOW_VISIBILITY_STATE_PARTICALLY_OCCLUSION));
visibilityChangeInfos = ssm_->GetWindowVisibilityChangeInfo(currVisibleData);
ASSERT_EQ(visibilityChangeInfos.size(), 1);
currVisibleData.clear();
ssm_->lastVisibleData_.clear();
currVisibleData.push_back(std::make_pair(1, WindowVisibilityState::WINDOW_VISIBILITY_STATE_TOTALLY_OCCUSION));
ssm_->lastVisibleData_.push_back(
std::make_pair(2, WindowVisibilityState::WINDOW_VISIBILITY_STATE_NO_OCCLUSION));
visibilityChangeInfos = ssm_->GetWindowVisibilityChangeInfo(currVisibleData);
ASSERT_EQ(visibilityChangeInfos.size(), 1);
ASSERT_EQ(visibilityChangeInfos[0].first, 2);
}
/**