mirror of
https://gitee.com/openharmony/window_window_manager
synced 2025-02-17 06:19:31 +00:00
commit
91db42dfb6
@ -1059,11 +1059,10 @@ private:
|
||||
* Window Property
|
||||
*/
|
||||
struct DrawingSessionInfo {
|
||||
uint64_t surfaceId_ = 0;
|
||||
int32_t pid_ = 0;
|
||||
int32_t uid_ = 0;
|
||||
};
|
||||
std::vector<DrawingSessionInfo> lastDrawingSessionInfoVec_;
|
||||
std::unordered_map<uint64_t, DrawingSessionInfo> lastDrawingSessionInfoMap_;
|
||||
|
||||
/**
|
||||
* PC Window
|
||||
|
@ -8004,11 +8004,10 @@ void SceneSessionManager::DealwithDrawingContentChange(const std::vector<std::pa
|
||||
|
||||
bool SceneSessionManager::GetSpecifiedDrawingData(uint64_t surfaceId, int32_t& pid, int32_t& uid)
|
||||
{
|
||||
auto it = std::find_if(lastDrawingSessionInfoVec_.begin(), lastDrawingSessionInfoVec_.end(),
|
||||
[surfaceId](const DrawingSessionInfo& info) { return info.surfaceId_ == surfaceId; });
|
||||
if (it != lastDrawingSessionInfoVec_.end()) {
|
||||
pid = it->pid_;
|
||||
uid = it->uid_;
|
||||
auto it = lastDrawingSessionInfoMap_.find(surfaceId);
|
||||
if (it != lastDrawingSessionInfoMap_.end()) {
|
||||
pid = it->second.pid_;
|
||||
uid = it->second.uid_;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -8016,10 +8015,9 @@ bool SceneSessionManager::GetSpecifiedDrawingData(uint64_t surfaceId, int32_t& p
|
||||
|
||||
void SceneSessionManager::RemoveSpecifiedDrawingData(uint64_t surfaceId)
|
||||
{
|
||||
auto it = std::find_if(lastDrawingSessionInfoVec_.begin(), lastDrawingSessionInfoVec_.end(),
|
||||
[surfaceId](const DrawingSessionInfo& info) { return info.surfaceId_ == surfaceId; });
|
||||
if (it != lastDrawingSessionInfoVec_.end()) {
|
||||
lastDrawingSessionInfoVec_.erase(it);
|
||||
auto it = lastDrawingSessionInfoMap_.find(surfaceId);
|
||||
if (it != lastDrawingSessionInfoMap_.end()) {
|
||||
lastDrawingSessionInfoMap_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8029,11 +8027,10 @@ std::vector<std::pair<uint64_t, bool>> SceneSessionManager::GetWindowDrawingCont
|
||||
std::vector<std::pair<uint64_t, bool>> processDrawingContentChangeInfo;
|
||||
for (const auto& [surfaceId, isWindowDrawing] : currDrawingContentData) {
|
||||
int32_t pid = 0;
|
||||
bool isPreWindowDrawing = GetPreWindowDrawingState(surfaceId, isWindowDrawing, pid);
|
||||
bool isProcessDrawingStateChanged = GetProcessDrawingState(surfaceId, pid);
|
||||
sptr<SceneSession> session = SelectSesssionFromMap(surfaceId);
|
||||
bool isDrawingStateChanged =
|
||||
session == nullptr || (isPreWindowDrawing != isWindowDrawing && isProcessDrawingStateChanged);
|
||||
session == nullptr || (GetPreWindowDrawingState(surfaceId, isWindowDrawing, pid) != isWindowDrawing &&
|
||||
GetProcessDrawingState(surfaceId, pid));
|
||||
if (isDrawingStateChanged) {
|
||||
processDrawingContentChangeInfo.emplace_back(surfaceId, isWindowDrawing);
|
||||
}
|
||||
@ -8056,8 +8053,7 @@ bool SceneSessionManager::GetPreWindowDrawingState(uint64_t surfaceId, bool curr
|
||||
|
||||
void SceneSessionManager::UpdateWindowDrawingData(uint64_t surfaceId, int32_t pid, int32_t uid)
|
||||
{
|
||||
RemoveSpecifiedDrawingData(surfaceId);
|
||||
lastDrawingSessionInfoVec_.push_back({ surfaceId, pid, uid });
|
||||
lastDrawingSessionInfoMap_[surfaceId] = { pid, uid };
|
||||
}
|
||||
|
||||
bool SceneSessionManager::GetProcessDrawingState(uint64_t surfaceId, int32_t pid)
|
||||
|
Loading…
x
Reference in New Issue
Block a user