From 33e98fc15921fa21cc1b43d556f16da207bc0a1c Mon Sep 17 00:00:00 2001 From: nickyhey Date: Wed, 19 Jul 2023 16:08:10 +0800 Subject: [PATCH 1/8] =?UTF-8?q?SCB=20=20session=E3=80=81window=E3=80=81mis?= =?UTF-8?q?sion=20ID=E5=BD=92=E4=B8=80=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nickyhey --- .../common/include/window_session_property.h | 12 +- .../common/src/window_session_property.cpp | 16 +-- .../dfx/include/dfx_hisysevent.h | 2 +- .../dfx/src/dfx_hisysevent.cpp | 2 +- .../service/anr_manager/include/anr_manager.h | 18 +-- .../service/anr_manager/src/anr_manager.cpp | 36 +++--- .../service/event_stage/include/event_stage.h | 14 +-- .../service/event_stage/src/event_stage.cpp | 18 +-- .../src/intention_event_manager.cpp | 2 +- window_scene/interfaces/include/ws_common.h | 6 +- .../js_scene_session.cpp | 4 +- .../js_scene_session_manager.cpp | 8 +- .../scene_session_manager/js_scene_utils.cpp | 6 +- .../host/include/move_drag_controller.h | 4 +- .../session/host/include/scene_persistence.h | 8 +- .../session/host/include/scene_session.h | 8 +- window_scene/session/host/include/session.h | 14 +-- .../host/include/zidl/session_interface.h | 4 +- .../session/host/include/zidl/session_proxy.h | 4 +- .../session/host/src/move_drag_controller.cpp | 4 +- .../session/host/src/scene_persistence.cpp | 6 +- .../session/host/src/scene_session.cpp | 16 +-- window_scene/session/host/src/session.cpp | 49 +++++---- .../session/host/src/zidl/session_proxy.cpp | 14 +-- .../session/host/src/zidl/session_stub.cpp | 10 +- .../include/extension_session_manager.h | 2 +- .../include/scene_session_manager.h | 44 ++++---- .../session_manager/include/session_manager.h | 6 +- .../zidl/scene_session_manager_interface.h | 6 +- .../zidl/scene_session_manager_proxy.h | 10 +- .../include/zidl/session_listener_interface.h | 4 +- .../include/zidl/session_listener_proxy.h | 4 +- .../src/extension_session_manager.cpp | 8 +- .../src/scene_session_manager.cpp | 104 +++++++++--------- .../session_manager/src/session_manager.cpp | 6 +- .../src/zidl/scene_session_manager_proxy.cpp | 20 ++-- .../src/zidl/scene_session_manager_stub.cpp | 14 +-- .../src/zidl/session_listener_proxy.cpp | 4 +- window_scene/test/mock/mock_session.h | 2 +- window_scene/test/unittest/session_test.cpp | 8 +- wm/include/window_adapter.h | 2 +- wm/include/window_scene_session_impl.h | 2 +- wm/include/window_session_impl.h | 22 ++-- wm/src/window_adapter.cpp | 2 +- wm/src/window_extension_session_impl.cpp | 10 +- wm/src/window_scene_session_impl.cpp | 62 +++++------ wm/src/window_session_impl.cpp | 54 ++++----- .../include/zidl/window_manager_interface.h | 2 +- 48 files changed, 342 insertions(+), 341 deletions(-) diff --git a/window_scene/common/include/window_session_property.h b/window_scene/common/include/window_session_property.h index 0c7cdf4e6d..23e7863f61 100755 --- a/window_scene/common/include/window_session_property.h +++ b/window_scene/common/include/window_session_property.h @@ -69,8 +69,8 @@ public: void SetDisplayId(uint64_t displayId); void SetWindowType(WindowType type); void SetParentId(uint32_t parentId); - void SetPersistentId(uint64_t persistentId); - void SetParentPersistentId(uint64_t persistentId); + void SetPersistentId(uint32_t persistentId); + void SetParentPersistentId(uint32_t persistentId); void SetAccessTokenId(uint32_t accessTokenId); void SetTokenState(bool hasToken); void SetMaximizeMode(MaximizeMode mode); @@ -101,8 +101,8 @@ public: uint32_t GetParentId() const; uint32_t GetWindowFlags() const; uint64_t GetDisplayId() const; - uint64_t GetPersistentId() const; - uint64_t GetParentPersistentId() const; + uint32_t GetPersistentId() const; + uint32_t GetParentPersistentId() const; uint32_t GetAccessTokenId() const; bool GetTokenState() const; MaximizeMode GetMaximizeMode() const; @@ -140,8 +140,8 @@ private: uint64_t displayId_ = 0; uint32_t parentId_ = INVALID_SESSION_ID; // parentId of sceneSession, which is low 32 bite of parentPersistentId_ uint32_t flags_ = 0; - uint64_t persistentId_ = INVALID_SESSION_ID; - uint64_t parentPersistentId_ = INVALID_SESSION_ID; + uint32_t persistentId_ = INVALID_SESSION_ID; + uint32_t parentPersistentId_ = INVALID_SESSION_ID; uint32_t accessTokenId_ = INVALID_SESSION_ID; MaximizeMode maximizeMode_ = MaximizeMode::MODE_RECOVER; WindowMode windowMode_ = WindowMode::WINDOW_MODE_FULLSCREEN; diff --git a/window_scene/common/src/window_session_property.cpp b/window_scene/common/src/window_session_property.cpp index 23d8bace2d..b36f8259cf 100755 --- a/window_scene/common/src/window_session_property.cpp +++ b/window_scene/common/src/window_session_property.cpp @@ -170,22 +170,22 @@ uint32_t WindowSessionProperty::GetWindowFlags() const return flags_; } -void WindowSessionProperty::SetPersistentId(uint64_t persistentId) +void WindowSessionProperty::SetPersistentId(uint32_t persistentId) { persistentId_ = persistentId; } -uint64_t WindowSessionProperty::GetPersistentId() const +uint32_t WindowSessionProperty::GetPersistentId() const { return persistentId_; } -void WindowSessionProperty::SetParentPersistentId(uint64_t persistentId) +void WindowSessionProperty::SetParentPersistentId(uint32_t persistentId) { parentPersistentId_ = persistentId; } -uint64_t WindowSessionProperty::GetParentPersistentId() const +uint32_t WindowSessionProperty::GetParentPersistentId() const { return parentPersistentId_; } @@ -371,10 +371,10 @@ bool WindowSessionProperty::Marshalling(Parcel& parcel) const parcel.WriteBool(focusable_) && parcel.WriteBool(touchable_) && parcel.WriteBool(tokenState_) && parcel.WriteBool(turnScreenOn_) && parcel.WriteBool(keepScreenOn_) && parcel.WriteBool(isPrivacyMode_) && parcel.WriteBool(isSystemPrivacyMode_) && - parcel.WriteUint64(displayId_) && parcel.WriteUint64(persistentId_) && + parcel.WriteUint64(displayId_) && parcel.WriteUint32(persistentId_) && parcel.WriteString(sessionInfo_.bundleName_) && parcel.WriteString(sessionInfo_.moduleName_) && parcel.WriteString(sessionInfo_.abilityName_) && - parcel.WriteUint64(parentPersistentId_) && + parcel.WriteUint32(parentPersistentId_) && parcel.WriteUint32(accessTokenId_) && parcel.WriteUint32(static_cast(maximizeMode_)) && parcel.WriteFloat(brightness_) && parcel.WriteUint32(static_cast(requestedOrientation_)) && @@ -405,10 +405,10 @@ WindowSessionProperty* WindowSessionProperty::Unmarshalling(Parcel& parcel) property->SetPrivacyMode(parcel.ReadBool()); property->SetSystemPrivacyMode(parcel.ReadBool()); property->SetDisplayId(parcel.ReadUint64()); - property->SetPersistentId(parcel.ReadUint64()); + property->SetPersistentId(parcel.ReadUint32()); SessionInfo info = { parcel.ReadString(), parcel.ReadString(), parcel.ReadString() }; property->SetSessionInfo(info); - property->SetParentPersistentId(parcel.ReadUint64()); + property->SetParentPersistentId(parcel.ReadUint32()); property->SetAccessTokenId(parcel.ReadUint32()); property->SetMaximizeMode(static_cast(parcel.ReadUint32())); property->SetBrightness(parcel.ReadFloat()); diff --git a/window_scene/intention_event/dfx/include/dfx_hisysevent.h b/window_scene/intention_event/dfx/include/dfx_hisysevent.h index 8568182ad3..abaa462d13 100644 --- a/window_scene/intention_event/dfx/include/dfx_hisysevent.h +++ b/window_scene/intention_event/dfx/include/dfx_hisysevent.h @@ -22,7 +22,7 @@ namespace OHOS { namespace Rosen { class DfxHisysevent { public: - static void ApplicationBlockInput(int32_t eventId, int32_t pid, uint64_t persistentId); + static void ApplicationBlockInput(int32_t eventId, int32_t pid, uint32_t persistentId); }; } // namespace Rosen } // namespace OHOS diff --git a/window_scene/intention_event/dfx/src/dfx_hisysevent.cpp b/window_scene/intention_event/dfx/src/dfx_hisysevent.cpp index 7d1835d53a..2234bf4f4a 100644 --- a/window_scene/intention_event/dfx/src/dfx_hisysevent.cpp +++ b/window_scene/intention_event/dfx/src/dfx_hisysevent.cpp @@ -23,7 +23,7 @@ namespace { constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "DfxHisysevent" }; } // namespace -void DfxHisysevent::ApplicationBlockInput(int32_t eventId, int32_t pid, uint64_t persistentId) +void DfxHisysevent::ApplicationBlockInput(int32_t eventId, int32_t pid, uint32_t persistentId) { CALL_DEBUG_ENTER; int32_t ret = HiSysEventWrite( diff --git a/window_scene/intention_event/service/anr_manager/include/anr_manager.h b/window_scene/intention_event/service/anr_manager/include/anr_manager.h index e482cfac93..9737a6fa0c 100644 --- a/window_scene/intention_event/service/anr_manager/include/anr_manager.h +++ b/window_scene/intention_event/service/anr_manager/include/anr_manager.h @@ -34,20 +34,20 @@ class ANRManager final { public: DISALLOW_COPY_AND_MOVE(ANRManager); void Init(); - void AddTimer(int32_t id, int64_t currentTime, uint64_t persistentId); - void MarkProcessed(int32_t eventId, uint64_t persistentId); - bool IsANRTriggered(int64_t time, uint64_t persistentId); - void OnSessionLost(uint64_t persistentId); - void SetApplicationPid(uint64_t persistentId, int32_t applicationPid); + void AddTimer(int32_t id, int64_t currentTime, uint32_t persistentId); + void MarkProcessed(int32_t eventId, uint32_t persistentId); + bool IsANRTriggered(int64_t time, uint32_t persistentId); + void OnSessionLost(uint32_t persistentId); + void SetApplicationPid(uint32_t persistentId, int32_t applicationPid); void SetAnrObserver(std::function anrObserver); private: - int32_t GetPidByPersistentId(uint64_t persistentId); - void RemoveTimers(uint64_t persistentId); - void RemovePersistentId(uint64_t persistentId); + int32_t GetPidByPersistentId(uint32_t persistentId); + void RemoveTimers(uint32_t persistentId); + void RemovePersistentId(uint32_t persistentId); private: std::mutex mtx_; int32_t anrTimerCount_ { 0 }; - std::unordered_map applicationMap_; + std::unordered_map applicationMap_; std::function anrObserver_; EventStage eventStage_; }; diff --git a/window_scene/intention_event/service/anr_manager/src/anr_manager.cpp b/window_scene/intention_event/service/anr_manager/src/anr_manager.cpp index 7ed4ca1406..a9005c2fc8 100644 --- a/window_scene/intention_event/service/anr_manager/src/anr_manager.cpp +++ b/window_scene/intention_event/service/anr_manager/src/anr_manager.cpp @@ -39,7 +39,7 @@ void ANRManager::Init() TimerMgr->Init(); } -void ANRManager::AddTimer(int32_t id, int64_t currentTime, uint64_t persistentId) +void ANRManager::AddTimer(int32_t id, int64_t currentTime, uint32_t persistentId) { std::lock_guard guard(mtx_); if (anrTimerCount_ >= MAX_ANR_TIMER_COUNT) { @@ -47,11 +47,11 @@ void ANRManager::AddTimer(int32_t id, int64_t currentTime, uint64_t persistentId return; } int32_t timerId = TimerMgr->AddTimer(ANRTimeOutTime::INPUT_UI_TIMEOUT_TIME, [this, id, persistentId]() { - WLOGFD("Anr callback enter. persistentId:%{public}" PRIu64 ", eventId:%{public}d", persistentId, id); + WLOGFD("Anr callback enter. persistentId:%{public}" PRIu32 ", eventId:%{public}d", persistentId, id); eventStage_.SetAnrStatus(persistentId, true); int32_t pid = GetPidByPersistentId(persistentId); DfxHisysevent::ApplicationBlockInput(id, pid, persistentId); - WLOGFE("Application not responding. persistentId:%{public}" PRIu64 ", eventId:%{public}d, pid:%{public}d", + WLOGFE("Application not responding. persistentId:%{public}" PRIu32", eventId:%{public}d, pid:%{public}d", persistentId, id, pid); if (anrObserver_ != nullptr) { anrObserver_(pid); @@ -65,17 +65,17 @@ void ANRManager::AddTimer(int32_t id, int64_t currentTime, uint64_t persistentId anrTimerCount_--; } } - WLOGFD("Anr callback leave. persistentId:%{public}" PRIu64 ", eventId:%{public}d", persistentId, id); + WLOGFD("Anr callback leave. persistentId:%{public}" PRIu32 ", eventId:%{public}d", persistentId, id); }); anrTimerCount_++; eventStage_.SaveANREvent(persistentId, id, currentTime, timerId); } -void ANRManager::MarkProcessed(int32_t eventId, uint64_t persistentId) +void ANRManager::MarkProcessed(int32_t eventId, uint32_t persistentId) { CALL_DEBUG_ENTER; std::lock_guard guard(mtx_); - WLOGFD("eventId:%{public}d, persistentId:%{public}" PRIu64 "", eventId, persistentId); + WLOGFD("eventId:%{public}d, persistentId:%{public}" PRIu32"", eventId, persistentId); std::list timerIds = eventStage_.DelEvents(persistentId, eventId); for (int32_t item : timerIds) { if (item != -1) { @@ -85,17 +85,17 @@ void ANRManager::MarkProcessed(int32_t eventId, uint64_t persistentId) } } -bool ANRManager::IsANRTriggered(int64_t time, uint64_t persistentId) +bool ANRManager::IsANRTriggered(int64_t time, uint32_t persistentId) { std::lock_guard guard(mtx_); if (eventStage_.CheckAnrStatus(persistentId)) { - WLOGFD("Application not responding. persistentId:%{public}" PRIu64 "", persistentId); + WLOGFD("Application not responding. persistentId:%{public}" PRIu32 "", persistentId); return true; } return false; } -void ANRManager::OnSessionLost(uint64_t persistentId) +void ANRManager::OnSessionLost(uint32_t persistentId) { CALL_DEBUG_ENTER; std::lock_guard guard(mtx_); @@ -103,10 +103,10 @@ void ANRManager::OnSessionLost(uint64_t persistentId) RemovePersistentId(persistentId); } -void ANRManager::SetApplicationPid(uint64_t persistentId, int32_t applicationPid) +void ANRManager::SetApplicationPid(uint32_t persistentId, int32_t applicationPid) { std::lock_guard guard(mtx_); - WLOGFD("persistentId:%{public}" PRIu64 " -> applicationPid:%{public}d", persistentId, applicationPid); + WLOGFD("persistentId:%{public}" PRIu32 " -> applicationPid:%{public}d", persistentId, applicationPid); applicationMap_[persistentId] = applicationPid; } @@ -117,17 +117,17 @@ void ANRManager::SetAnrObserver(std::function anrObserver) anrObserver_ = anrObserver; } -int32_t ANRManager::GetPidByPersistentId(uint64_t persistentId) +int32_t ANRManager::GetPidByPersistentId(uint32_t persistentId) { if (applicationMap_.find(persistentId) != applicationMap_.end()) { - WLOGFD("persistentId:%{public}" PRIu64 " -> pid:%{public}d", persistentId, applicationMap_[persistentId]); + WLOGFD("persistentId:%{public}" PRIu32 " -> pid:%{public}d", persistentId, applicationMap_[persistentId]); return applicationMap_[persistentId]; } - WLOGFD("No application matches persistentId:%{public}" PRIu64 "", persistentId); + WLOGFD("No application matches persistentId:%{public}" PRIu32 "", persistentId); return -1; } -void ANRManager::RemoveTimers(uint64_t persistentId) +void ANRManager::RemoveTimers(uint32_t persistentId) { std::vector timerIds = eventStage_.GetTimerIds(persistentId); for (int32_t item : timerIds) { @@ -138,13 +138,13 @@ void ANRManager::RemoveTimers(uint64_t persistentId) } } -void ANRManager::RemovePersistentId(uint64_t persistentId) +void ANRManager::RemovePersistentId(uint32_t persistentId) { if (applicationMap_.find(persistentId) == applicationMap_.end()) { - WLOGFD("No persistentId:%{public}" PRIu64 " in applicationMap", persistentId); + WLOGFD("No persistentId:%{public}" PRIu32 " in applicationMap", persistentId); return; } - WLOGFD("Remove persistentId:%{public}" PRIu64 " -> applicationPid:%{public}d", + WLOGFD("Remove persistentId:%{public}" PRIu32 " -> applicationPid:%{public}d", persistentId, applicationMap_[persistentId]); applicationMap_.erase(persistentId); } diff --git a/window_scene/intention_event/service/event_stage/include/event_stage.h b/window_scene/intention_event/service/event_stage/include/event_stage.h index 385b6237ae..7c0b50d26e 100644 --- a/window_scene/intention_event/service/event_stage/include/event_stage.h +++ b/window_scene/intention_event/service/event_stage/include/event_stage.h @@ -23,19 +23,19 @@ namespace OHOS { namespace Rosen { class EventStage { public: - void SetAnrStatus(uint64_t persistentId, bool status); - bool CheckAnrStatus(uint64_t persistentId); - void SaveANREvent(uint64_t persistentId, int32_t id, int64_t time, int32_t timerId); - std::vector GetTimerIds(uint64_t persistentId); - std::list DelEvents(uint64_t persistentId, int32_t id); + void SetAnrStatus(uint32_t persistentId, bool status); + bool CheckAnrStatus(uint32_t persistentId); + void SaveANREvent(uint32_t persistentId, int32_t id, int64_t time, int32_t timerId); + std::vector GetTimerIds(uint32_t persistentId); + std::list DelEvents(uint32_t persistentId, int32_t id); private: struct EventTime { int32_t id { 0 }; int64_t eventTime { 0 }; int32_t timerId { -1 }; }; - std::map> events_; - std::map isAnrProcess_; + std::map> events_; + std::map isAnrProcess_; }; } // namespace Rosen } // namespace OHOS diff --git a/window_scene/intention_event/service/event_stage/src/event_stage.cpp b/window_scene/intention_event/service/event_stage/src/event_stage.cpp index 6fcb7138ce..a22e599493 100644 --- a/window_scene/intention_event/service/event_stage/src/event_stage.cpp +++ b/window_scene/intention_event/service/event_stage/src/event_stage.cpp @@ -29,30 +29,30 @@ namespace { constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "EventStage" }; } // namespace -void EventStage::SetAnrStatus(uint64_t persistentId, bool status) +void EventStage::SetAnrStatus(uint32_t persistentId, bool status) { isAnrProcess_[persistentId] = status; } -bool EventStage::CheckAnrStatus(uint64_t persistentId) +bool EventStage::CheckAnrStatus(uint32_t persistentId) { if (isAnrProcess_.find(persistentId) != isAnrProcess_.end()) { return isAnrProcess_[persistentId]; } - WLOGFD("Current persistentId:%{public}" PRIu64 " is not in event stage", persistentId); + WLOGFD("Current persistentId:%{public}" PRIu32 " is not in event stage", persistentId); return false; } -void EventStage::SaveANREvent(uint64_t persistentId, int32_t id, int64_t time, int32_t timerId) +void EventStage::SaveANREvent(uint32_t persistentId, int32_t id, int64_t time, int32_t timerId) { EventTime eventTime { id, time, timerId }; events_[persistentId].push_back(eventTime); } -std::vector EventStage::GetTimerIds(uint64_t persistentId) +std::vector EventStage::GetTimerIds(uint32_t persistentId) { if (events_.find(persistentId) == events_.end()) { - WLOGFD("Current events have no event for persistentId:%{public}" PRIu64 "", persistentId); + WLOGFD("Current events have no event for persistentId:%{public}" PRIu32 "", persistentId); return {}; } std::vector timers; @@ -63,11 +63,11 @@ std::vector EventStage::GetTimerIds(uint64_t persistentId) return timers; } -std::list EventStage::DelEvents(uint64_t persistentId, int32_t id) +std::list EventStage::DelEvents(uint32_t persistentId, int32_t id) { - WLOGFD("Delete events, persistentId:%{public}" PRIu64 ", id:%{public}d", persistentId, id); + WLOGFD("Delete events, persistentId:%{public}" PRIu32 ", id:%{public}d", persistentId, id); if (events_.find(persistentId) == events_.end()) { - WLOGFD("Current events have no event persistentId:%{public}" PRIu64 "", persistentId); + WLOGFD("Current events have no event persistentId:%{public}" PRIu32 "", persistentId); return {}; } auto &events = events_[persistentId]; diff --git a/window_scene/intention_event/src/intention_event_manager.cpp b/window_scene/intention_event/src/intention_event_manager.cpp index d346591b89..1e1c9a0e08 100644 --- a/window_scene/intention_event/src/intention_event_manager.cpp +++ b/window_scene/intention_event/src/intention_event_manager.cpp @@ -69,7 +69,7 @@ void IntentionEventManager::InputEventListener::OnInputEvent( void IntentionEventManager::InputEventListener::OnInputEvent( std::shared_ptr keyEvent) const { - uint64_t focusedSessionId = SceneSessionManager::GetInstance().GetFocusedSession(); + auto focusedSessionId = SceneSessionManager::GetInstance().GetFocusedSession(); if (focusedSessionId == INVALID_SESSION_ID) { WLOGFE("focusedSessionId is invalid"); return; diff --git a/window_scene/interfaces/include/ws_common.h b/window_scene/interfaces/include/ws_common.h index 16d8fffa86..cc77972924 100644 --- a/window_scene/interfaces/include/ws_common.h +++ b/window_scene/interfaces/include/ws_common.h @@ -28,7 +28,7 @@ class AbilityStartSetting; } namespace OHOS::Rosen { -constexpr uint64_t INVALID_SESSION_ID = 0; +constexpr uint32_t INVALID_SESSION_ID = 0; enum class WSError : int32_t { WS_OK = 0, @@ -110,8 +110,8 @@ struct SessionInfo { int32_t requestCode; int32_t errorCode; std::string errorReason; - uint64_t persistentId_ = INVALID_SESSION_ID; - uint64_t callerPersistentId_ = INVALID_SESSION_ID; + uint32_t persistentId_ = INVALID_SESSION_ID; + uint32_t callerPersistentId_ = INVALID_SESSION_ID; uint32_t callState_ = 0; int64_t uiAbilityId_ = 0; }; diff --git a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.cpp b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.cpp index 4b2772d5fe..ab7952c13c 100644 --- a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.cpp +++ b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.cpp @@ -58,8 +58,8 @@ NativeValue* JsSceneSession::Create(NativeEngine& engine, const sptr jsSceneSession = std::make_unique(engine, session); object->SetNativePointer(jsSceneSession.release(), JsSceneSession::Finalizer, nullptr); - object->SetProperty("persistentId", CreateJsValue(engine, static_cast(session->GetPersistentId()))); - object->SetProperty("parentId", CreateJsValue(engine, static_cast(session->GetParentPersistentId()))); + object->SetProperty("persistentId", CreateJsValue(engine, static_cast(session->GetPersistentId()))); + object->SetProperty("parentId", CreateJsValue(engine, static_cast(session->GetParentPersistentId()))); object->SetProperty("type", CreateJsValue(engine, static_cast(GetApiType(session->GetWindowType())))); const char* moduleName = "JsSceneSession"; BindNativeFunction(engine, *object, "on", moduleName, JsSceneSession::RegisterCallback); diff --git a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp index 6fd46733f0..bee72ee888 100644 --- a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp +++ b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp @@ -381,7 +381,7 @@ NativeValue* JsSceneSessionManager::OnUpdateFocus(NativeEngine& engine, NativeCa "Input parameter is missing or invalid")); return engine.CreateUndefined(); } - int64_t persistentId; + uint32_t persistentId; if (!ConvertFromJsValue(engine, info.argv[0], persistentId)) { WLOGFE("[NAPI]Failed to convert parameter to persistentId"); engine.Throw(CreateJsError(engine, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), @@ -395,7 +395,7 @@ NativeValue* JsSceneSessionManager::OnUpdateFocus(NativeEngine& engine, NativeCa "Input parameter is missing or invalid")); return engine.CreateUndefined(); } - SceneSessionManager::GetInstance().UpdateFocus(static_cast(persistentId), isFocused); + SceneSessionManager::GetInstance().UpdateFocus(persistentId, isFocused); return engine.CreateUndefined(); } @@ -745,14 +745,14 @@ NativeValue* JsSceneSessionManager::OnGetSessionSnapshot(NativeEngine& engine, N "Input parameter is missing or invalid")); return engine.CreateUndefined(); } - int64_t persistentId; + uint32_t persistentId; if (!ConvertFromJsValue(engine, info.argv[0], persistentId)) { WLOGFE("[NAPI]Failed to convert parameter to persistentId"); engine.Throw(CreateJsError(engine, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), "Input parameter is missing or invalid")); return engine.CreateUndefined(); } - std::string path = SceneSessionManager::GetInstance().GetSessionSnapshot(static_cast(persistentId)); + std::string path = SceneSessionManager::GetInstance().GetSessionSnapshot(persistentId); NativeValue* result = engine.CreateString(path.c_str(), path.length()); return result; } diff --git a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_utils.cpp b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_utils.cpp index d2062cb62a..d0915d1392 100644 --- a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_utils.cpp +++ b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_utils.cpp @@ -69,7 +69,7 @@ bool ConvertSessionInfoFromJs(NativeEngine& engine, NativeObject* jsObject, Sess sessionInfo.isSystem_ = isSystem; } if (jsPersistentId->TypeOf() != NATIVE_UNDEFINED) { - int64_t persistentId; + uint32_t persistentId; if (!ConvertFromJsValue(engine, jsPersistentId, persistentId)) { WLOGFE("[NAPI]Failed to convert parameter to persistentId"); return false; @@ -110,9 +110,9 @@ NativeValue* CreateJsSessionInfo(NativeEngine& engine, const SessionInfo& sessio object->SetProperty("moduleName", CreateJsValue(engine, sessionInfo.moduleName_)); object->SetProperty("abilityName", CreateJsValue(engine, sessionInfo.abilityName_)); object->SetProperty("isSystem", CreateJsValue(engine, sessionInfo.isSystem_)); - object->SetProperty("persistentId", CreateJsValue(engine, static_cast(sessionInfo.persistentId_))); + object->SetProperty("persistentId", CreateJsValue(engine, static_cast(sessionInfo.persistentId_))); object->SetProperty("callerPersistentId", CreateJsValue(engine, - static_cast(sessionInfo.callerPersistentId_))); + static_cast(sessionInfo.callerPersistentId_))); object->SetProperty("callState", CreateJsValue(engine, static_cast(sessionInfo.callState_))); return objValue; } diff --git a/window_scene/session/host/include/move_drag_controller.h b/window_scene/session/host/include/move_drag_controller.h index 773b71d48f..209db234f3 100644 --- a/window_scene/session/host/include/move_drag_controller.h +++ b/window_scene/session/host/include/move_drag_controller.h @@ -56,7 +56,7 @@ public: } }; - MoveDragController(uint64_t persistentId); + MoveDragController(uint32_t persistentId); ~MoveDragController(); void SetVsyncHandleListenser(const NotifyVsyncHandleFunc& func); @@ -112,7 +112,7 @@ private: MoveDragProperty moveDragProperty_ = { -1, -1, -1, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }; std::shared_ptr vsyncCallback_ = std::make_shared(VsyncCallback()); NotifyVsyncHandleFunc vsyncHandleFunc_; - uint64_t persistentId_; + uint32_t persistentId_; enum class DragType : uint32_t { DRAG_UNDEFINED, diff --git a/window_scene/session/host/include/scene_persistence.h b/window_scene/session/host/include/scene_persistence.h index 124fda6206..b4c818d94a 100644 --- a/window_scene/session/host/include/scene_persistence.h +++ b/window_scene/session/host/include/scene_persistence.h @@ -33,10 +33,10 @@ namespace OHOS::Rosen { class ScenePersistence : public RefBase { public: ScenePersistence() = default; - ScenePersistence(const SessionInfo &info, const uint64_t persistentId); + ScenePersistence(const SessionInfo& info, const uint32_t& persistentId); ~ScenePersistence() = default; - static inline bool CreateSnapshotDir(std::string strFilesDir) + static inline bool CreateSnapshotDir(const std::string& strFilesDir) { strPersistPath_ = strFilesDir + "/SceneSnapShot/"; constexpr mode_t MKDIR_MODE = 0740; @@ -48,8 +48,8 @@ public: bool IsSnapshotExisted() const; std::string GetSnapshotFilePath() const; - void SetPersistentId(const uint64_t persistId); - void SaveSnapshot(const std::shared_ptr &pixelMap); + void SetPersistentId(const uint32_t& persistId); + void SaveSnapshot(const std::shared_ptr& pixelMap); private: static std::string strPersistPath_; diff --git a/window_scene/session/host/include/scene_session.h b/window_scene/session/host/include/scene_session.h index 2cd97c1ee7..2b67d1a64f 100644 --- a/window_scene/session/host/include/scene_session.h +++ b/window_scene/session/host/include/scene_session.h @@ -27,10 +27,10 @@ namespace OHOS::Rosen { class SceneSession; using SpecificSessionCreateCallback = std::function(const SessionInfo& info, sptr property)>; -using SpecificSessionDestroyCallback = std::function; +using SpecificSessionDestroyCallback = std::function; using CameraFloatSessionChangeCallback = std::function; using GetSceneSessionVectorByTypeCallback = std::function>(WindowType type)>; -using UpdateAvoidAreaCallback = std::function; +using UpdateAvoidAreaCallback = std::function; using NotifyCreateSpecificSessionFunc = std::function& session)>; using NotifySessionRectChangeFunc = std::function; @@ -89,8 +89,8 @@ public: WSError UpdateSessionRect(const WSRect& rect, const SizeChangeReason& reason) override; WSError CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) override; - WSError DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) override; + sptr property, uint32_t& persistentId, sptr& session) override; + WSError DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) override; WSError SetSystemBarProperty(WindowType type, SystemBarProperty systemBarProperty); WSError OnNeedAvoid(bool status) override; void CalculateAvoidAreaRect(WSRect& rect, WSRect& avoidRect, AvoidArea& avoidArea); diff --git a/window_scene/session/host/include/session.h b/window_scene/session/host/include/session.h index 445c94e656..a306bac0f8 100644 --- a/window_scene/session/host/include/session.h +++ b/window_scene/session/host/include/session.h @@ -43,7 +43,7 @@ namespace OHOS::Rosen { class RSSurfaceNode; using NotifyPendingSessionActivationFunc = std::function; using NotifySessionStateChangeFunc = std::function; -using NotifySessionStateChangeNotifyManagerFunc = std::function; +using NotifySessionStateChangeNotifyManagerFunc = std::function; using NotifyBackPressedFunc = std::function; using NotifySessionFocusableChangeFunc = std::function; using NotifySessionTouchableChangeFunc = std::function; @@ -53,7 +53,7 @@ using NotifyTerminateSessionFuncNew = std::function; using NotifyPendingSessionToForegroundFunc = std::function; using NotifyPendingSessionToBackgroundForDelegatorFunc = std::function; -using NotifyCallingSessionForegroundFunc = std::function; +using NotifyCallingSessionForegroundFunc = std::function; using NotifyCallingSessionBackgroundFunc = std::function; class ILifecycleListener { @@ -69,8 +69,8 @@ public: explicit Session(const SessionInfo& info) : sessionInfo_(info) {} virtual ~Session() = default; - uint64_t GetPersistentId() const; - uint64_t GetParentPersistentId() const; + uint32_t GetPersistentId() const; + uint32_t GetParentPersistentId() const; void SetSessionRect(const WSRect& rect); std::shared_ptr GetSurfaceNode() const; @@ -137,8 +137,8 @@ public: WSError UpdateSessionRect(const WSRect& rect, const SizeChangeReason& reason) override; WSError CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) override; - WSError DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) override; + sptr property, uint32_t& persistentId, sptr& session) override; + WSError DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) override; void SetSystemConfig(const SystemSessionConfig& systemConfig); void SetBackPressedListenser(const NotifyBackPressedFunc& func); WSError ProcessBackEvent(); // send back event to session_stage @@ -256,7 +256,7 @@ private: std::shared_ptr CreateSurfaceNode(const std::string& name); std::shared_ptr Snapshot(); - uint64_t persistentId_ = INVALID_SESSION_ID; + uint32_t persistentId_ = INVALID_SESSION_ID; static std::atomic sessionId_; static std::set persistIdSet_; std::shared_ptr surfaceNode_ = nullptr; diff --git a/window_scene/session/host/include/zidl/session_interface.h b/window_scene/session/host/include/zidl/session_interface.h index c7fe76bca8..6d8ece7ba8 100644 --- a/window_scene/session/host/include/zidl/session_interface.h +++ b/window_scene/session/host/include/zidl/session_interface.h @@ -82,8 +82,8 @@ public: virtual WSError UpdateSessionRect(const WSRect& rect, const SizeChangeReason& reason) = 0; virtual WSError CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) = 0; - virtual WSError DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) = 0; + sptr property, uint32_t& persistentId, sptr& session) = 0; + virtual WSError DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) = 0; virtual WSError OnNeedAvoid(bool status) = 0; virtual AvoidArea GetAvoidAreaByType(AvoidAreaType type) = 0; virtual WSError RequestSessionBack() = 0; diff --git a/window_scene/session/host/include/zidl/session_proxy.h b/window_scene/session/host/include/zidl/session_proxy.h index 0253f5a2cb..639b506306 100644 --- a/window_scene/session/host/include/zidl/session_proxy.h +++ b/window_scene/session/host/include/zidl/session_proxy.h @@ -41,8 +41,8 @@ public: WSError UpdateSessionRect(const WSRect& rect, const SizeChangeReason& reason) override; WSError CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) override; - WSError DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) override; + sptr property, uint32_t& persistentId, sptr& session) override; + WSError DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) override; WSError OnNeedAvoid(bool status) override; AvoidArea GetAvoidAreaByType(AvoidAreaType type) override; WSError RequestSessionBack() override; diff --git a/window_scene/session/host/src/move_drag_controller.cpp b/window_scene/session/host/src/move_drag_controller.cpp index 1c62c0112e..2ae45107df 100644 --- a/window_scene/session/host/src/move_drag_controller.cpp +++ b/window_scene/session/host/src/move_drag_controller.cpp @@ -31,7 +31,7 @@ namespace { constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "MoveDragController" }; } -MoveDragController::MoveDragController(uint64_t persistentId) : persistentId_(persistentId) +MoveDragController::MoveDragController(uint32_t persistentId) : persistentId_(persistentId) { vsyncCallback_->onCallback = std::bind(&MoveDragController::OnReceiveVsync, this, std::placeholders::_1); } @@ -617,7 +617,7 @@ void MoveDragController::HandleMouseStyle(const std::shared_ptr &pixelMap) +void ScenePersistence::SaveSnapshot(const std::shared_ptr& pixelMap) { if (pixelMap == nullptr || strSnapshotFile_.find('/') == std::string::npos) { return; diff --git a/window_scene/session/host/src/scene_session.cpp b/window_scene/session/host/src/scene_session.cpp index 5b12a90df0..70127b3e44 100644 --- a/window_scene/session/host/src/scene_session.cpp +++ b/window_scene/session/host/src/scene_session.cpp @@ -217,9 +217,9 @@ WSError SceneSession::RaiseToAppTop() WSError SceneSession::CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) + sptr property, uint32_t& persistentId, sptr& session) { - WLOGFI("CreateAndConnectSpecificSession id: %{public}" PRIu64 "", GetPersistentId()); + WLOGFI("CreateAndConnectSpecificSession id: %{public}" PRIu32 "", GetPersistentId()); sptr sceneSession; if (specificCallback_ != nullptr) { sceneSession = specificCallback_->onCreate_(sessionInfo_, property); @@ -241,7 +241,7 @@ WSError SceneSession::CreateAndConnectSpecificSession(const sptr& return errCode; } -WSError SceneSession::DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) +WSError SceneSession::DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) { WSError ret = WSError::WS_OK; if (specificCallback_ != nullptr) { @@ -570,7 +570,7 @@ bool SceneSession::IsKeepScreenOn() const std::string SceneSession::GetSessionSnapshot() { - WLOGFI("GetSessionSnapshot id %{public}" PRIu64 "", GetPersistentId()); + WLOGFI("GetSessionSnapshot id %{public}" PRIu32 "", GetPersistentId()); if (Session::GetSessionState() < SessionState::STATE_BACKGROUND) { Session::UpdateSnapshot(); } @@ -594,7 +594,7 @@ WSError SceneSession::UpdateWindowAnimationFlag(bool needDefaultAnimationFlag) void SceneSession::NotifyIsCustomAnimatiomPlaying(bool isPlaying) { - WLOGFI("id %{public}" PRIu64 " %{public}u", GetPersistentId(), isPlaying); + WLOGFI("id %{public}" PRIu32 " %{public}u", GetPersistentId(), isPlaying); for (auto& sessionChangeCallback : sessionChangeCallbackList_) { if (sessionChangeCallback != nullptr && sessionChangeCallback->onIsCustomAnimationPlaying_) { sessionChangeCallback->onIsCustomAnimationPlaying_(isPlaying); @@ -604,15 +604,15 @@ void SceneSession::NotifyIsCustomAnimatiomPlaying(bool isPlaying) WSError SceneSession::UpdateWindowSceneAfterCustomAnimation(bool isAdd) { - WLOGFI("id %{public}" PRIu64 "", GetPersistentId()); + WLOGFI("id %{public}" PRIu32 "", GetPersistentId()); if (isAdd) { if (!setWindowScenePatternFunc_ || !setWindowScenePatternFunc_->setOpacityFunc_) { - WLOGFE("SetOpacityFunc not register %{public}" PRIu64 "", GetPersistentId()); + WLOGFE("SetOpacityFunc not register %{public}" PRIu32 "", GetPersistentId()); return WSError::WS_ERROR_INVALID_OPERATION; } setWindowScenePatternFunc_->setOpacityFunc_(1.0f); } else { - WLOGFI("background after custom animation id %{public}" PRIu64 "", GetPersistentId()); + WLOGFI("background after custom animation id %{public}" PRIu32 "", GetPersistentId()); // since background will remove surfaceNode Background(); NotifyIsCustomAnimatiomPlaying(false); diff --git a/window_scene/session/host/src/session.cpp b/window_scene/session/host/src/session.cpp index fb5416b6d7..1b41cf0184 100644 --- a/window_scene/session/host/src/session.cpp +++ b/window_scene/session/host/src/session.cpp @@ -39,12 +39,12 @@ constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "Sessio std::atomic Session::sessionId_(INVALID_SESSION_ID); std::set Session::persistIdSet_; -uint64_t Session::GetPersistentId() const +uint32_t Session::GetPersistentId() const { return persistentId_; } -uint64_t Session::GetParentPersistentId() const +uint32_t Session::GetParentPersistentId() const { if (property_ != nullptr) { return property_->GetParentPersistentId(); @@ -297,7 +297,7 @@ bool Session::IsSessionValid() const { bool res = state_ > SessionState::STATE_DISCONNECT && state_ < SessionState::STATE_END; if (!res) { - WLOGFI("session is already destroyed or not created! id: %{public}" PRIu64 " state: %{public}u", + WLOGFI("session is already destroyed or not created! id: %{public}" PRIu32 " state: %{public}u", GetPersistentId(), state_); } return res; @@ -305,7 +305,7 @@ bool Session::IsSessionValid() const WSError Session::UpdateRect(const WSRect& rect, SizeChangeReason reason) { - WLOGFI("session update rect: id: %{public}" PRIu64 ", rect[%{public}d, %{public}d, %{public}u, %{public}u], "\ + WLOGFI("session update rect: id: %{public}" PRIu32 ", rect[%{public}d, %{public}d, %{public}u, %{public}u], "\ "reason:%{public}u", GetPersistentId(), rect.posX_, rect.posY_, rect.width_, rect.height_, reason); if (!IsSessionValid()) { winRect_ = rect; @@ -327,7 +327,7 @@ WSError Session::Connect(const sptr& sessionStage, const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, SystemSessionConfig& systemConfig, sptr property, sptr token) { - WLOGFI("Connect session, id: %{public}" PRIu64 ", state: %{public}u", GetPersistentId(), + WLOGFI("Connect session, id: %{public}" PRIu32 ", state: %{public}u", GetPersistentId(), static_cast(GetSessionState())); if (GetSessionState() != SessionState::STATE_DISCONNECT) { WLOGFE("state is not disconnect!"); @@ -365,7 +365,7 @@ WSError Session::UpdateWindowSessionProperty(sptr propert WSError Session::Foreground(sptr property) { SessionState state = GetSessionState(); - WLOGFI("Foreground session, id: %{public}" PRIu64 ", state: %{public}u", GetPersistentId(), + WLOGFI("Foreground session, id: %{public}" PRIu32 ", state: %{public}" PRIu32"", GetPersistentId(), static_cast(state)); if (state != SessionState::STATE_CONNECT && state != SessionState::STATE_BACKGROUND) { WLOGFE("state invalid!"); @@ -395,7 +395,7 @@ void Session::NotifyCallingSessionForeground() WSError Session::Background() { SessionState state = GetSessionState(); - WLOGFI("Background session, id: %{public}" PRIu64 ", state: %{public}u", GetPersistentId(), + WLOGFI("Background session, id: %{public}" PRIu32 ", state: %{public}" PRIu32"", GetPersistentId(), static_cast(state)); if (state < SessionState::STATE_INACTIVE) { // only STATE_INACTIVE can transfer to background WLOGFE("state invalid!"); @@ -421,7 +421,7 @@ void Session::NotifyCallingSessionBackground() WSError Session::Disconnect() { SessionState state = GetSessionState(); - WLOGFI("Disconnect session, id: %{public}" PRIu64 ", state: %{public}u", GetPersistentId(), + WLOGFI("Disconnect session, id: %{public}" PRIu32 ", state: %{public}" PRIu32"", GetPersistentId(), static_cast(state)); state_ = SessionState::STATE_INACTIVE; NotifyDisconnect(); @@ -436,8 +436,8 @@ WSError Session::Disconnect() WSError Session::SetActive(bool active) { SessionState state = GetSessionState(); - WLOGFI("Session update active: %{public}d, id: %{public}" PRIu64 ", state: %{public}u", active, GetPersistentId(), - static_cast(state)); + WLOGFI("Session update active: %{public}d, id: %{public}" PRIu32 ", state: %{public}" PRIu32"", + active, GetPersistentId(), static_cast(state)); if (!IsSessionValid()) { return WSError::WS_ERROR_INVALID_SESSION; } @@ -478,7 +478,7 @@ WSError Session::PendingSessionActivation(const sptr ability info.startSetting = abilitySessionInfo->startSetting; WLOGFI("PendingSessionActivation:bundleName %{public}s, moduleName:%{public}s, abilityName:%{public}s", info.bundleName_.c_str(), info.moduleName_.c_str(), info.abilityName_.c_str()); - WLOGFI("PendingSessionActivation callState:%{public}d, want persistentId: %{public}" PRIu64 ", \ + WLOGFI("PendingSessionActivation callState:%{public}d, want persistentId: %{public}" PRIu32 ", \ uiAbilityId: %{public}" PRIu64 "", info.callState_, info.persistentId_, info.uiAbilityId_); if (pendingSessionActivationFunc_) { pendingSessionActivationFunc_(info); @@ -506,7 +506,7 @@ WSError Session::TerminateSession(const sptr abilitySessionI info.abilityName_ = abilitySessionInfo->want.GetElement().GetAbilityName(); info.bundleName_ = abilitySessionInfo->want.GetElement().GetBundleName(); info.callerToken_ = abilitySessionInfo->callerToken; - info.persistentId_ = abilitySessionInfo->persistentId; + info.persistentId_ = static_cast(abilitySessionInfo->persistentId); sessionInfo_.want = new AAFwk::Want(abilitySessionInfo->want); sessionInfo_.resultCode = abilitySessionInfo->resultCode; if (terminateSessionFunc_) { @@ -530,7 +530,7 @@ WSError Session::TerminateSessionNew(const sptr abilitySessi info.abilityName_ = abilitySessionInfo->want.GetElement().GetAbilityName(); info.bundleName_ = abilitySessionInfo->want.GetElement().GetBundleName(); info.callerToken_ = abilitySessionInfo->callerToken; - info.persistentId_ = abilitySessionInfo->persistentId; + info.persistentId_ = static_cast(abilitySessionInfo->persistentId); sessionInfo_.want = new AAFwk::Want(abilitySessionInfo->want); sessionInfo_.resultCode = abilitySessionInfo->resultCode; if (terminateSessionFuncNew_) { @@ -556,7 +556,7 @@ WSError Session::NotifySessionException(const sptr abilitySe info.callerToken_ = abilitySessionInfo->callerToken; info.errorCode = abilitySessionInfo->errorCode; info.errorReason = abilitySessionInfo->errorReason; - info.persistentId_ = abilitySessionInfo->persistentId; + info.persistentId_ = static_cast(abilitySessionInfo->persistentId); sessionInfo_.want = new AAFwk::Want(abilitySessionInfo->want); sessionInfo_.errorCode = abilitySessionInfo->errorCode; sessionInfo_.errorReason = abilitySessionInfo->errorReason; @@ -586,7 +586,8 @@ WSError Session::PendingSessionToForeground() return WSError::WS_OK; } -void Session::SetPendingSessionToBackgroundForDelegatorListener(const NotifyPendingSessionToBackgroundForDelegatorFunc& func) +void Session::SetPendingSessionToBackgroundForDelegatorListener( + const NotifyPendingSessionToBackgroundForDelegatorFunc& func) { pendingSessionToBackgroundForDelegatorFunc_ = func; } @@ -678,7 +679,7 @@ WSError Session::TransferPointerEvent(const std::shared_ptr& return WSError::WS_ERROR_INVALID_PERMISSION; } } - WLOGFD("Session TransferPointEvent, Id: %{public}" PRIu64 ", eventId: %{public}d", + WLOGFD("Session TransferPointEvent, Id: %{public}" PRIu32 ", eventId: %{public}d", persistentId_, pointerEvent->GetId()); auto currentTime = GetSysClockTime(); if (DelayedSingleton::GetInstance()->IsANRTriggered(currentTime, persistentId_)) { @@ -714,7 +715,7 @@ WSError Session::TransferKeyEvent(const std::shared_ptr& keyEvent return WSError::WS_ERROR_INVALID_PERMISSION; } } - WLOGFD("Session TransferKeyEvent, Id: %{public}" PRIu64 ", eventId: %{public}d", + WLOGFD("Session TransferKeyEvent, Id: %{public}" PRIu32 ", eventId: %{public}d", persistentId_, keyEvent->GetId()); auto currentTime = GetSysClockTime(); if (DelayedSingleton::GetInstance()->IsANRTriggered(currentTime, persistentId_)) { @@ -725,7 +726,7 @@ WSError Session::TransferKeyEvent(const std::shared_ptr& keyEvent WLOGFE("windowEventChannel_ is null"); return WSError::WS_ERROR_NULLPTR; } - WLOGD("TransferKeyEvent, id: %{public}" PRIu64, persistentId_); + WLOGD("TransferKeyEvent, id: %{public}" PRIu32, persistentId_); if (WSError ret = windowEventChannel_->TransferKeyEvent(keyEvent); ret != WSError::WS_OK) { WLOGFE("TransferKeyEvent failed"); return ret; @@ -858,7 +859,7 @@ void Session::NotifyClick() WSError Session::UpdateFocus(bool isFocused) { - WLOGFI("Session update focus id: %{public}" PRIu64, GetPersistentId()); + WLOGFI("Session update focus id: %{public}" PRIu32, GetPersistentId()); if (isFocused_ == isFocused) { WLOGFD("Session focus do not change: [%{public}d]", isFocused); return WSError::WS_DO_NOTHING; @@ -932,12 +933,12 @@ WSError Session::RaiseToAppTop() WSError Session::CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) + sptr property, uint32_t& persistentId, sptr& session) { return WSError::WS_OK; } -WSError Session::DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) +WSError Session::DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) { return WSError::WS_OK; } @@ -980,8 +981,8 @@ WSError Session::ProcessBackEvent() WSError Session::MarkProcessed(int32_t eventId) { - uint64_t persistentId = GetPersistentId(); - WLOGFI("persistentId:%{public}" PRIu64 ", eventId:%{public}d", persistentId, eventId); + uint32_t persistentId = GetPersistentId(); + WLOGFI("persistentId:%{public}" PRIu32 ", eventId:%{public}d", persistentId, eventId); DelayedSingleton::GetInstance()->MarkProcessed(eventId, persistentId); return WSError::WS_OK; } @@ -990,7 +991,7 @@ void Session::GeneratePersistentId(bool isExtension, const SessionInfo& sessionI { if (sessionInfo.persistentId_ != INVALID_SESSION_ID) { persistIdSet_.insert(sessionInfo.persistentId_); - persistentId_ = static_cast(sessionInfo.persistentId_); + persistentId_ = static_cast(sessionInfo.persistentId_); return; } diff --git a/window_scene/session/host/src/zidl/session_proxy.cpp b/window_scene/session/host/src/zidl/session_proxy.cpp index 0e18a66873..f752641f94 100644 --- a/window_scene/session/host/src/zidl/session_proxy.cpp +++ b/window_scene/session/host/src/zidl/session_proxy.cpp @@ -146,7 +146,7 @@ WSError SessionProxy::Connect(const sptr& sessionStage, const spt sptr config = reply.ReadParcelable(); systemConfig = *config; if (property) { - property->SetPersistentId(reply.ReadUint64()); + property->SetPersistentId(reply.ReadUint32()); } int32_t ret = reply.ReadInt32(); return static_cast(ret); @@ -187,7 +187,7 @@ WSError SessionProxy::PendingSessionActivation(sptr abilityS WLOGFE("Write requestCode info failed"); return WSError::WS_ERROR_IPC_FAILED; } - if (!(data.WriteInt64(abilitySessionInfo->persistentId))) { + if (!(data.WriteInt32(static_cast(abilitySessionInfo->persistentId)))) { WLOGFE("Write persistentId failed"); return WSError::WS_ERROR_IPC_FAILED; } @@ -384,7 +384,7 @@ WSError SessionProxy::UpdateSessionRect(const WSRect& rect, const SizeChangeReas WSError SessionProxy::CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) + sptr property, uint32_t& persistentId, sptr& session) { MessageParcel data; MessageParcel reply; @@ -423,7 +423,7 @@ WSError SessionProxy::CreateAndConnectSpecificSession(const sptr& WLOGFE("SendRequest failed"); return WSError::WS_ERROR_IPC_FAILED; } - persistentId = reply.ReadUint64(); + persistentId = reply.ReadUint32(); sptr sessionObject = reply.ReadRemoteObject(); if (sessionObject == nullptr) { WLOGFE("ReadRemoteObject failed"); @@ -434,7 +434,7 @@ WSError SessionProxy::CreateAndConnectSpecificSession(const sptr& return static_cast(ret); } -WSError SessionProxy::DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) +WSError SessionProxy::DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) { MessageParcel data; MessageParcel reply; @@ -443,8 +443,8 @@ WSError SessionProxy::DestroyAndDisconnectSpecificSession(const uint64_t& persis WLOGFE("WriteInterfaceToken failed"); return WSError::WS_ERROR_IPC_FAILED; } - if (!data.WriteUint64(persistentId)) { - WLOGFE("Write uint64_t failed"); + if (!data.WriteUint32(persistentId)) { + WLOGFE("Write persistentId failed"); } if (Remote()->SendRequest(static_cast( SessionMessage::TRANS_ID_DESTROY_AND_DISCONNECT_SPECIFIC_SESSION), diff --git a/window_scene/session/host/src/zidl/session_stub.cpp b/window_scene/session/host/src/zidl/session_stub.cpp index 403e5813a7..70e34744cc 100644 --- a/window_scene/session/host/src/zidl/session_stub.cpp +++ b/window_scene/session/host/src/zidl/session_stub.cpp @@ -164,7 +164,7 @@ int SessionStub::HandleConnect(MessageParcel& data, MessageParcel& reply) WSError errCode = Connect(sessionStage, eventChannel, surfaceNode, systemConfig, property, token); reply.WriteParcelable(&systemConfig); if (property) { - reply.WriteUint64(property->GetPersistentId()); + reply.WriteUint32(property->GetPersistentId()); } reply.WriteUint32(static_cast(errCode)); return ERR_NONE; @@ -221,7 +221,7 @@ int SessionStub::HandlePendingSessionActivation(MessageParcel& data, MessageParc abilitySessionInfo->callerToken = data.ReadRemoteObject(); } abilitySessionInfo->requestCode = data.ReadInt32(); - abilitySessionInfo->persistentId = data.ReadUint64(); + abilitySessionInfo->persistentId = data.ReadUint32(); abilitySessionInfo->state = static_cast(data.ReadInt32()); abilitySessionInfo->uiAbilityId = data.ReadInt64(); if (data.ReadBool()) { @@ -276,14 +276,14 @@ int SessionStub::HandleCreateAndConnectSpecificSession(MessageParcel& data, Mess } else { WLOGFW("Property not exist!"); } - uint64_t persistentId = INVALID_SESSION_ID; + auto persistentId = INVALID_SESSION_ID; sptr sceneSession; CreateAndConnectSpecificSession(sessionStage, eventChannel, surfaceNode, property, persistentId, sceneSession); if (sceneSession== nullptr) { return ERR_INVALID_STATE; } - reply.WriteUint64(persistentId); + reply.WriteUint32(persistentId); reply.WriteRemoteObject(sceneSession->AsObject()); reply.WriteUint32(static_cast(WSError::WS_OK)); return ERR_NONE; @@ -291,7 +291,7 @@ int SessionStub::HandleCreateAndConnectSpecificSession(MessageParcel& data, Mess int SessionStub::HandleDestroyAndDisconnectSpecificSession(MessageParcel& data, MessageParcel& reply) { - uint64_t persistentId = data.ReadUint64(); + auto persistentId = data.ReadUint32(); const WSError& ret = DestroyAndDisconnectSpecificSession(persistentId); reply.WriteUint32(static_cast(ret)); return ERR_NONE; diff --git a/window_scene/session_manager/include/extension_session_manager.h b/window_scene/session_manager/include/extension_session_manager.h index 2d31276973..a6a689569e 100644 --- a/window_scene/session_manager/include/extension_session_manager.h +++ b/window_scene/session_manager/include/extension_session_manager.h @@ -63,7 +63,7 @@ private: sptr SetAbilitySessionInfo(const sptr& extensionSession); std::shared_ptr taskScheduler_; - std::map> extensionSessionMap_; + std::map> extensionSessionMap_; }; } // namespace OHOS::Rosen diff --git a/window_scene/session_manager/include/scene_session_manager.h b/window_scene/session_manager/include/scene_session_manager.h index 063b432c88..c84103d4f8 100644 --- a/window_scene/session_manager/include/scene_session_manager.h +++ b/window_scene/session_manager/include/scene_session_manager.h @@ -58,11 +58,11 @@ public: WSError RequestSceneSessionByCall(const sptr& sceneSession); void StartAbilityBySpecified(const SessionInfo& sessionInfo); sptr GetRootSceneSession(); - sptr GetSceneSession(uint64_t persistentId); + sptr GetSceneSession(uint32_t persistentId); WSError CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session); - WSError DestroyAndDisconnectSpecificSession(const uint64_t& persistentId); + sptr property, uint32_t& persistentId, sptr& session); + WSError DestroyAndDisconnectSpecificSession(const uint32_t& persistentId); WSError UpdateProperty(sptr& property, WSPropertyChangeAction action); void SetCreateSpecificSessionListener(const NotifyCreateSpecificSessionFunc& func); void SetGestureNavigationEnabledChangeListener(const ProcessGestureNavigationEnabledChangeFunc& func); @@ -77,16 +77,16 @@ public: WMError UnregisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent); - WSError SetFocusedSession(uint64_t persistentId); - uint64_t GetFocusedSession() const; + WSError SetFocusedSession(uint32_t persistentId); + uint32_t GetFocusedSession() const; WSError GetAllSessionDumpInfo(std::string& info); WSError GetSessionDumpInfo(const sptr& param, std::string& info); - WSError UpdateFocus(uint64_t persistentId, bool isFocused); + WSError UpdateFocus(uint32_t persistentId, bool isFocused); WSError SwitchUser(int32_t oldUserId, int32_t newUserId, std::string &fileDir); int32_t GetCurrentUserId() const; void StartWindowInfoReportLoop(); void GetFocusWindowInfo(FocusChangeInfo& focusInfo); - WSError SetSessionGravity(uint64_t persistentId, SessionGravity gravity, uint32_t percent); + WSError SetSessionGravity(uint32_t persistentId, SessionGravity gravity, uint32_t percent); WSError SetSessionLabel(const sptr &token, const std::string &label); WSError SetSessionIcon(const sptr &token, const std::shared_ptr &icon); WSError RegisterSessionListener(const sptr sessionListener); @@ -98,11 +98,11 @@ public: WSError PendingSessionToBackgroundForDelegator(const sptr &token); WSError GetFocusSessionToken(sptr &token); WSError TerminateSessionNew(const sptr info, bool needStartCaller); - WSError UpdateSessionAvoidAreaListener(uint64_t& persistentId, bool haveListener); + WSError UpdateSessionAvoidAreaListener(uint32_t& persistentId, bool haveListener); void UpdatePrivateStateAndNotify(bool isAddingPrivateSession); void InitPersistentStorage(); - std::string GetSessionSnapshot(uint64_t persistentId); + std::string GetSessionSnapshot(uint32_t persistentId); void OnOutsideDownEvent(int32_t x, int32_t y); WMError GetAccessibilityWindowInfo(std::vector>& infos); @@ -138,11 +138,11 @@ private: sptr FindMainWindowWithToken(sptr targetToken); WSError UpdateParentSession(const sptr& sceneSession, sptr property); void UpdateCameraFloatWindowStatus(uint32_t accessTokenId, bool isShowing); - void UpdateFocusableProperty(uint64_t persistentId); + void UpdateFocusableProperty(uint32_t persistentId); std::vector> GetSceneSessionVectorByType(WindowType type); - bool UpdateSessionAvoidAreaIfNeed(const uint64_t& persistentId, + bool UpdateSessionAvoidAreaIfNeed(const uint32_t& persistentId, const AvoidArea& avoidArea, AvoidAreaType avoidAreaType); - bool UpdateAvoidArea(const uint64_t& persistentId); + bool UpdateAvoidArea(const uint32_t& persistentId); sptr GetBundleManager(); std::shared_ptr CreateResourceManager( @@ -152,12 +152,12 @@ private: const WindowSceneConfig::ConfigItem& curveConfig, const std::string& nodeName = "keyboardAnimation"); WSError SetBrightness(const sptr& sceneSession, float brightness); - WSError UpdateBrightness(uint64_t persistentId); + WSError UpdateBrightness(uint32_t persistentId); void SetDisplayBrightness(float brightness); float GetDisplayBrightness() const; void HandleUpdateProperty(const sptr& property, WSPropertyChangeAction action, const sptr& sceneSession); - void NotifyWindowInfoChange(uint64_t persistentId, WindowUpdateType type); + void NotifyWindowInfoChange(uint32_t persistentId, WindowUpdateType type); void FillWindowInfo(std::vector>& infos, const sptr sceneSession); std::vector> GetWindowVisibilityChangeInfo( @@ -165,24 +165,24 @@ private: void WindowVisibilityChangeCallback(std::shared_ptr occlusiontionData); void WindowDestroyNotifyVisibility(const sptr& sceneSession); void RegisterSessionRectChangeNotifyManagerFunc(sptr& sceneSession); - void OnSessionRectChange(uint64_t persistentId, const WSRect& rect); + void OnSessionRectChange(uint32_t persistentId, const WSRect& rect); void RegisterInputMethodShownFunc(const sptr& sceneSession); - void OnInputMethodShown(const uint64_t& persistentId); + void OnInputMethodShown(const uint32_t& persistentId); void RegisterInputMethodHideFunc(const sptr& sceneSession); sptr rootSceneSession_; - std::map> sceneSessionMap_; + std::map> sceneSessionMap_; std::set> avoidAreaListenerSessionSet_; - std::map> lastUpdatedAvoidArea_; + std::map> lastUpdatedAvoidArea_; NotifyCreateSpecificSessionFunc createSpecificSessionFunc_; ProcessGestureNavigationEnabledChangeFunc gestureNavigationEnabledChangeFunc_; ProcessOutsideDownEventFunc outsideDownEventFunc_; AppWindowSceneConfig appWindowSceneConfig_; SystemSessionConfig systemConfig_; - uint64_t activeSessionId_ = INVALID_SESSION_ID; - uint64_t focusedSessionId_ = INVALID_SESSION_ID; - uint64_t brightnessSessionId_ = INVALID_SESSION_ID; + uint32_t activeSessionId_ = INVALID_SESSION_ID; + uint32_t focusedSessionId_ = INVALID_SESSION_ID; + uint32_t brightnessSessionId_ = INVALID_SESSION_ID; float displayBrightness_ = UNDEFINED_BRIGHTNESS; WSRect callingWindowRestoringRect_ = {0, 0, 0, 0}; int32_t currentUserId_; @@ -196,7 +196,7 @@ private: std::shared_ptr lastOcclusionData_ = std::make_shared(); RSInterfaces& rsInterface_; void RegisterSessionStateChangeNotifyManagerFunc(sptr& sceneSession); - void OnSessionStateChange(uint64_t persistentId); + void OnSessionStateChange(uint32_t persistentId); sptr sessionListener_; sptr FindSessionByToken(const sptr &token); diff --git a/window_scene/session_manager/include/session_manager.h b/window_scene/session_manager/include/session_manager.h index 2fb1d4aabf..d235d55ba4 100644 --- a/window_scene/session_manager/include/session_manager.h +++ b/window_scene/session_manager/include/session_manager.h @@ -30,10 +30,10 @@ WM_DECLARE_SINGLE_INSTANCE_BASE(SessionManager); public: void CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session); - void DestroyAndDisconnectSpecificSession(const uint64_t& persistentId); + sptr property, uint32_t& persistentId, sptr& session); + void DestroyAndDisconnectSpecificSession(const uint32_t& persistentId); WMError UpdateProperty(sptr& property, WSPropertyChangeAction action); - WMError SetSessionGravity(uint64_t persistentId, SessionGravity gravity, uint32_t percent); + WMError SetSessionGravity(uint32_t persistentId, SessionGravity gravity, uint32_t percent); WMError BindDialogTarget(uint64_t persistentId, sptr targetToken); sptr GetSceneSessionManagerProxy(); diff --git a/window_scene/session_manager/include/zidl/scene_session_manager_interface.h b/window_scene/session_manager/include/zidl/scene_session_manager_interface.h index 04200a598a..fa5d0b1e3e 100644 --- a/window_scene/session_manager/include/zidl/scene_session_manager_interface.h +++ b/window_scene/session_manager/include/zidl/scene_session_manager_interface.h @@ -64,11 +64,11 @@ public: virtual WSError CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) = 0; - virtual WSError DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) = 0; + sptr property, uint32_t& persistentId, sptr& session) = 0; + virtual WSError DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) = 0; virtual WSError UpdateProperty(sptr& property, WSPropertyChangeAction action) = 0; virtual WSError BindDialogTarget(uint64_t persistentId, sptr targetToken) = 0; - virtual WSError SetSessionGravity(uint64_t persistentId, SessionGravity gravity, uint32_t percent) = 0; + virtual WSError SetSessionGravity(uint32_t persistentId, SessionGravity gravity, uint32_t percent) = 0; virtual WSError SetSessionLabel(const sptr &token, const std::string &label) = 0; virtual WSError SetSessionIcon(const sptr &token, const std::shared_ptr &icon) = 0; virtual WSError RegisterSessionListener(const sptr sessionListener) = 0; diff --git a/window_scene/session_manager/include/zidl/scene_session_manager_proxy.h b/window_scene/session_manager/include/zidl/scene_session_manager_proxy.h index 413a00b17a..a0c07b4a97 100644 --- a/window_scene/session_manager/include/zidl/scene_session_manager_proxy.h +++ b/window_scene/session_manager/include/zidl/scene_session_manager_proxy.h @@ -29,8 +29,8 @@ public: WSError CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) override; - WSError DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) override; + sptr property, uint32_t& persistentId, sptr& session) override; + WSError DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) override; WSError UpdateProperty(sptr& property, WSPropertyChangeAction action) override; WSError BindDialogTarget(uint64_t persistentId, sptr targetToken) override; @@ -39,7 +39,7 @@ public: WMError UnregisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent) override; void GetFocusWindowInfo(FocusChangeInfo& focusInfo) override; - WSError SetSessionGravity(uint64_t persistentId, SessionGravity gravity, uint32_t percent) override; + WSError SetSessionGravity(uint32_t persistentId, SessionGravity gravity, uint32_t percent) override; WMError SetGestureNavigaionEnabled(bool enable) override; WSError SetSessionLabel(const sptr &token, const std::string &label) override; WSError SetSessionIcon(const sptr &token, const std::shared_ptr &icon) override; @@ -51,11 +51,11 @@ public: WSError GetFocusSessionToken(sptr &token) override; WSError TerminateSessionNew(const sptr info, bool needStartCaller) override; WSError GetSessionDumpInfo(const sptr ¶m, std::string& info) override; - WSError UpdateSessionAvoidAreaListener(uint64_t& persistentId, bool haveListener) override; + WSError UpdateSessionAvoidAreaListener(uint32_t& persistentId, bool haveListener) override; private: static inline BrokerDelegator delegator_; }; } // namespace OHOS::Rosen -#endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_PROXY_H \ No newline at end of file +#endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_PROXY_H diff --git a/window_scene/session_manager/include/zidl/session_listener_interface.h b/window_scene/session_manager/include/zidl/session_listener_interface.h index f51d98cc3c..67aaf31792 100644 --- a/window_scene/session_manager/include/zidl/session_listener_interface.h +++ b/window_scene/session_manager/include/zidl/session_listener_interface.h @@ -27,8 +27,8 @@ class ISessionListener : public IRemoteBroker { public: DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ISessionListener"); - virtual void OnSessionLabelChange(int persistentId, const std::string &label) = 0; - virtual void OnSessionIconChange(int persistentId, const std::shared_ptr &icon) = 0; + virtual void OnSessionLabelChange(uint32_t persistentId, const std::string &label) = 0; + virtual void OnSessionIconChange(uint32_t persistentId, const std::shared_ptr &icon) = 0; }; } // namespace OHOS::Rosen #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_LISTENER_INTERFACE_H \ No newline at end of file diff --git a/window_scene/session_manager/include/zidl/session_listener_proxy.h b/window_scene/session_manager/include/zidl/session_listener_proxy.h index 66cc2aa32b..73a904a753 100644 --- a/window_scene/session_manager/include/zidl/session_listener_proxy.h +++ b/window_scene/session_manager/include/zidl/session_listener_proxy.h @@ -26,8 +26,8 @@ public: : IRemoteProxy(impl) {}; ~SessionListenerProxy() {}; - virtual void OnSessionLabelChange(int persistentId, const std::string &label) override; - virtual void OnSessionIconChange(int persistentId, const std::shared_ptr &icon) override; + virtual void OnSessionLabelChange(uint32_t persistentId, const std::string &label) override; + virtual void OnSessionIconChange(uint32_t persistentId, const std::shared_ptr &icon) override; }; } // namespace OHOS::Rosen #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_LISTENER_PROXY_H \ No newline at end of file diff --git a/window_scene/session_manager/src/extension_session_manager.cpp b/window_scene/session_manager/src/extension_session_manager.cpp index 4434fa1bf3..7c09b89847 100644 --- a/window_scene/session_manager/src/extension_session_manager.cpp +++ b/window_scene/session_manager/src/extension_session_manager.cpp @@ -70,7 +70,7 @@ sptr ExtensionSessionManager::RequestExtensionSession(const Se return extensionSession; } auto persistentId = extensionSession->GetPersistentId(); - WLOGFI("create session persistentId: %{public}" PRIu64 ", bundleName: %{public}s, abilityName: %{public}s", + WLOGFI("create session persistentId: %{public}" PRIu32 ", bundleName: %{public}s, abilityName: %{public}s", persistentId, sessionInfo.bundleName_.c_str(), sessionInfo.abilityName_.c_str()); extensionSessionMap_.insert({ persistentId, extensionSession }); return extensionSession; @@ -90,7 +90,7 @@ WSError ExtensionSessionManager::RequestExtensionSessionActivation(const sptrGetPersistentId(); - WLOGFI("Activate session with persistentId: %{public}" PRIu64, persistentId); + WLOGFI("Activate session with persistentId: %{public}" PRIu32, persistentId); if (extensionSessionMap_.count(persistentId) == 0) { WLOGFE("Session is invalid!"); return WSError::WS_ERROR_INVALID_SESSION; @@ -119,7 +119,7 @@ WSError ExtensionSessionManager::RequestExtensionSessionBackground(const sptrGetPersistentId(); - WLOGFI("Background session with persistentId: %{public}" PRIu64, persistentId); + WLOGFI("Background session with persistentId: %{public}" PRIu32, persistentId); extSession->SetActive(false); extSession->Background(); if (extensionSessionMap_.count(persistentId) == 0) { @@ -149,7 +149,7 @@ WSError ExtensionSessionManager::RequestExtensionSessionDestruction(const sptrGetPersistentId(); - WLOGFI("Destroy session with persistentId: %{public}" PRIu64, persistentId); + WLOGFI("Destroy session with persistentId: %{public}" PRIu32, persistentId); extSession->Disconnect(); if (extensionSessionMap_.count(persistentId) == 0) { WLOGFE("Session is invalid!"); diff --git a/window_scene/session_manager/src/scene_session_manager.cpp b/window_scene/session_manager/src/scene_session_manager.cpp index aaa417077a..02a66e64de 100644 --- a/window_scene/session_manager/src/scene_session_manager.cpp +++ b/window_scene/session_manager/src/scene_session_manager.cpp @@ -516,12 +516,12 @@ sptr SceneSessionManager::GetRootSceneSession() return taskScheduler_->PostSyncTask(task); } -sptr SceneSessionManager::GetSceneSession(uint64_t persistentId) +sptr SceneSessionManager::GetSceneSession(uint32_t persistentId) { return taskScheduler_->PostSyncTask([this, persistentId]() -> sptr { auto iter = sceneSessionMap_.find(persistentId); if (iter == sceneSessionMap_.end()) { - WLOGFE("Error found scene session with id: %{public}" PRIu64, persistentId); + WLOGFE("Error found scene session with id: %{public}" PRIu32, persistentId); return nullptr; } return iter->second; @@ -577,7 +577,7 @@ sptr SceneSessionManager::RequestSceneSession(const SessionInfo& s if (sessionInfo.persistentId_ != 0) { auto session = GetSceneSession(sessionInfo.persistentId_); if (session != nullptr) { - WLOGFI("get exist session persistentId: %{public}" PRIu64 "", sessionInfo.persistentId_); + WLOGFI("get exist session persistentId: %{public}" PRIu32 "", sessionInfo.persistentId_); return session; } } @@ -611,7 +611,7 @@ sptr SceneSessionManager::RequestSceneSession(const SessionInfo& s sceneSession->SetCallingUid(IPCSkeleton::GetCallingUid()); } auto persistentId = sceneSession->GetPersistentId(); - HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSession(%" PRIu64" )", persistentId); + HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSession(%" PRIu32" )", persistentId); sceneSession->SetSystemConfig(systemConfig_); UpdateParentSession(sceneSession, property); sceneSessionMap_.insert({ persistentId, sceneSession }); @@ -619,7 +619,7 @@ sptr SceneSessionManager::RequestSceneSession(const SessionInfo& s RegisterSessionRectChangeNotifyManagerFunc(sceneSession); RegisterInputMethodShownFunc(sceneSession); RegisterInputMethodHideFunc(sceneSession); - WLOGFI("create session persistentId: %{public}" PRIu64 "", persistentId); + WLOGFI("create session persistentId: %{public}" PRIu32 "", persistentId); return sceneSession; }; @@ -632,14 +632,14 @@ void SceneSessionManager::RegisterInputMethodShownFunc(const sptr& WLOGFE("session is nullptr"); return; } - NotifyCallingSessionForegroundFunc onInputMethodShown = [this](uint64_t persistentId) { + NotifyCallingSessionForegroundFunc onInputMethodShown = [this](uint32_t persistentId) { this->OnInputMethodShown(persistentId); }; sceneSession->SetNotifyCallingSessionForegroundFunc(onInputMethodShown); WLOGFD("RegisterInputMethodShownFunc success"); } -void SceneSessionManager::OnInputMethodShown(const uint64_t& persistentId) +void SceneSessionManager::OnInputMethodShown(const uint32_t& persistentId) { WLOGFD("Resize input method calling window"); auto scnSession = GetSceneSession(persistentId); @@ -698,10 +698,10 @@ WSError SceneSessionManager::RequestSceneSessionActivation(const sptrGetPersistentId(); - HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSessionActivation(%" PRIu64" )", persistentId); - WLOGFI("active persistentId: %{public}" PRIu64 "", persistentId); + HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSessionActivation(%" PRIu32" )", persistentId); + WLOGFI("active persistentId: %{public}" PRIu32 "", persistentId); if (sceneSessionMap_.count(persistentId) == 0) { - WLOGFE("session is invalid with %{public}" PRIu64 "", persistentId); + WLOGFE("session is invalid with %{public}" PRIu32 "", persistentId); return WSError::WS_ERROR_INVALID_SESSION; } auto scnSessionInfo = SetAbilitySessionInfo(scnSession); @@ -729,12 +729,12 @@ WSError SceneSessionManager::RequestSceneSessionBackground(const sptrGetPersistentId(); - WLOGFI("background session persistentId: %{public}" PRIu64 "", persistentId); - HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSessionBackground (%" PRIu64" )", persistentId); + WLOGFI("background session persistentId: %{public}" PRIu32 "", persistentId); + HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSessionBackground (%" PRIu32" )", persistentId); scnSession->SetActive(false); scnSession->Background(); if (sceneSessionMap_.count(persistentId) == 0) { - WLOGFE("session is invalid with %{public}" PRIu64 "", persistentId); + WLOGFE("session is invalid with %{public}" PRIu32 "", persistentId); return WSError::WS_ERROR_INVALID_SESSION; } if (persistentId == brightnessSessionId_) { @@ -770,7 +770,7 @@ WSError SceneSessionManager::DestroyDialogWithMainWindow(const sptrGetPersistentId()) == 0) { - WLOGFE("session is invalid with %{public}" PRIu64 "", dialog->GetPersistentId()); + WLOGFE("session is invalid with %{public}" PRIu32 "", dialog->GetPersistentId()); return WSError::WS_ERROR_INVALID_SESSION; } auto sceneSession = GetSceneSession(dialog->GetPersistentId()); @@ -796,12 +796,12 @@ WSError SceneSessionManager::RequestSceneSessionDestruction(const sptrGetPersistentId(); DestroyDialogWithMainWindow(scnSession); - WLOGFI("destroy session persistentId: %{public}" PRIu64 "", persistentId); - HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSessionDestruction (%" PRIu64" )", persistentId); + WLOGFI("destroy session persistentId: %{public}" PRIu32 "", persistentId); + HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSessionDestruction (%" PRIu32" )", persistentId); WindowDestroyNotifyVisibility(scnSession); scnSession->Disconnect(); if (sceneSessionMap_.count(persistentId) == 0) { - WLOGFE("session is invalid with %{public}" PRIu64 "", persistentId); + WLOGFE("session is invalid with %{public}" PRIu32 "", persistentId); return WSError::WS_ERROR_INVALID_SESSION; } auto scnSessionInfo = SetAbilitySessionInfo(scnSession); @@ -820,7 +820,7 @@ WSError SceneSessionManager::RequestSceneSessionDestruction(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) + sptr property, uint32_t& persistentId, sptr& session) { if (!SessionPermission::IsSystemCalling() && !SessionPermission::IsStartedByInputMethod()) { WLOGFE("check input method permission failed"); @@ -881,10 +881,10 @@ void SceneSessionManager::SetOutsideDownEventListener(const ProcessOutsideDownEv outsideDownEventFunc_ = func; } -WSError SceneSessionManager::DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) +WSError SceneSessionManager::DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) { auto task = [this, persistentId]() { - WLOGFI("Destroy specific session persistentId: %{public}" PRIu64, persistentId); + WLOGFI("Destroy specific session persistentId: %{public}" PRIu32, persistentId); auto sceneSession = GetSceneSession(persistentId); if (sceneSession == nullptr) { return WSError::WS_ERROR_NULLPTR; @@ -921,7 +921,7 @@ WSError SceneSessionManager::ProcessBackEvent() if (!session) { return WSError::WS_ERROR_INVALID_SESSION; } - WLOGFD("ProcessBackEvent session persistentId: %{public}" PRIu64 "", activeSessionId_); + WLOGFD("ProcessBackEvent session persistentId: %{public}" PRIu32 "", activeSessionId_); session->ProcessBackEvent(); return WSError::WS_OK; }; @@ -1060,7 +1060,7 @@ WSError SceneSessionManager::UpdateProperty(sptr& propert if (sceneSession == nullptr) { return; } - WLOGI("Id: %{public}" PRIu64 ", action: %{public}u", sceneSession->GetPersistentId(), action); + WLOGI("Id: %{public}" PRIu32 ", action: %{public}u", sceneSession->GetPersistentId(), action); HandleUpdateProperty(property, action, sceneSession); }; taskScheduler_->PostAsyncTask(task); @@ -1224,7 +1224,7 @@ WSError SceneSessionManager::SetBrightness(const sptr& sceneSessio return WSError::WS_OK; } -WSError SceneSessionManager::UpdateBrightness(uint64_t persistentId) +WSError SceneSessionManager::UpdateBrightness(uint32_t persistentId) { auto sceneSession = GetSceneSession(persistentId); if (sceneSession == nullptr) { @@ -1289,10 +1289,10 @@ WMError SceneSessionManager::SetGestureNavigaionEnabled(bool enable) return taskScheduler_->PostSyncTask(task); } -WSError SceneSessionManager::SetFocusedSession(uint64_t persistentId) +WSError SceneSessionManager::SetFocusedSession(uint32_t persistentId) { if (focusedSessionId_ == persistentId) { - WLOGI("Focus scene not change, id: %{public}" PRIu64, focusedSessionId_); + WLOGI("Focus scene not change, id: %{public}" PRIu32, focusedSessionId_); return WSError::WS_DO_NOTHING; } focusedSessionId_ = persistentId; @@ -1300,7 +1300,7 @@ WSError SceneSessionManager::SetFocusedSession(uint64_t persistentId) return WSError::WS_OK; } -uint64_t SceneSessionManager::GetFocusedSession() const +uint32_t SceneSessionManager::GetFocusedSession() const { return focusedSessionId_; } @@ -1374,10 +1374,10 @@ WSError SceneSessionManager::GetSessionDumpInfo(const sptr& param, st return GetAllSessionDumpInfo(info); } -WSError SceneSessionManager::UpdateFocus(uint64_t persistentId, bool isFocused) +WSError SceneSessionManager::UpdateFocus(uint32_t persistentId, bool isFocused) { auto task = [this, persistentId, isFocused]() { - WLOGFD("Update focus, id: %{public}" PRIu64", isFocused: %{public}u", persistentId, static_cast(isFocused)); + WLOGFD("Update focus, id: %{public}" PRIu32", isFocused: %{public}u", persistentId, static_cast(isFocused)); // notify session and client auto sceneSession = GetSceneSession(persistentId); if (sceneSession == nullptr) { @@ -1428,7 +1428,7 @@ void SceneSessionManager::RegisterSessionRectChangeNotifyManagerFunc(sptrGetPersistentId(); + auto persistentId = sceneSession->GetPersistentId(); NotifySessionRectChangeFunc onRectChange = [this, persistentId](const WSRect& rect) { this->OnSessionRectChange(persistentId, rect); }; @@ -1440,7 +1440,7 @@ void SceneSessionManager::RegisterSessionRectChangeNotifyManagerFunc(sptr& sceneSession) { - NotifySessionStateChangeNotifyManagerFunc func = [this](int64_t persistentId) { + NotifySessionStateChangeNotifyManagerFunc func = [this](uint32_t persistentId) { this->OnSessionStateChange(persistentId); }; if (sceneSession == nullptr) { @@ -1451,9 +1451,9 @@ void SceneSessionManager::RegisterSessionStateChangeNotifyManagerFunc(sptr& return WSError::WS_ERROR_NULLPTR; } auto persistentId = scnSession->GetPersistentId(); - WLOGFI("RequestSceneSessionByCall persistentId: %{public}" PRIu64 "", persistentId); + WLOGFI("RequestSceneSessionByCall persistentId: %{public}" PRIu32 "", persistentId); if (sceneSessionMap_.count(persistentId) == 0) { - WLOGFE("session is invalid with %{public}" PRIu64 "", persistentId); + WLOGFE("session is invalid with %{public}" PRIu32 "", persistentId); return WSError::WS_ERROR_INVALID_SESSION; } auto sessionInfo = scnSession->GetSessionInfo(); - WLOGFI("RequestSceneSessionByCall callState:%{public}d, persistentId: %{public}" PRIu64 "", + WLOGFI("RequestSceneSessionByCall callState:%{public}d, persistentId: %{public}" PRIu32 "", sessionInfo.callState_, persistentId); auto abilitySessionInfo = SetAbilitySessionInfo(scnSession); if (!abilitySessionInfo) { @@ -1676,7 +1676,7 @@ WSError SceneSessionManager::BindDialogTarget(uint64_t persistentId, sptr(persistentId)); if (scnSession == nullptr) { WLOGFE("Session is nullptr"); return WSError::WS_ERROR_NULLPTR; @@ -1692,7 +1692,7 @@ WSError SceneSessionManager::BindDialogTarget(uint64_t persistentId, sptrSetParentSession(parentSession); - WLOGFD("Bind dialog success, dialog id %{public}" PRIu64 ", parent id %{public}" PRIu64 "", + WLOGFD("Bind dialog success, dialog id %{public}" PRIu64 ", parent id %{public}" PRIu32 "", persistentId, parentSession->GetPersistentId()); return WSError::WS_OK; } @@ -1802,7 +1802,7 @@ void SceneSessionManager::RestoreCallingSessionSizeIfNeed() callingWindowRestoringRect_ = { 0, 0, 0, 0 }; } -WSError SceneSessionManager::SetSessionGravity(uint64_t persistentId, SessionGravity gravity, uint32_t percent) +WSError SceneSessionManager::SetSessionGravity(uint32_t persistentId, SessionGravity gravity, uint32_t percent) { auto sceneSession = GetSceneSession(persistentId); if (!sceneSession) { @@ -1870,7 +1870,7 @@ void SceneSessionManager::InitPersistentStorage() } } -void SceneSessionManager::OnSessionRectChange(uint64_t persistentId, const WSRect& rect) +void SceneSessionManager::OnSessionRectChange(uint32_t persistentId, const WSRect& rect) { WLOGFI("OnSessionRectChange"); NotifyWindowInfoChange(persistentId, WindowUpdateType::WINDOW_UPDATE_BOUNDS); @@ -1879,19 +1879,19 @@ void SceneSessionManager::OnSessionRectChange(uint64_t persistentId, const WSRec WMError SceneSessionManager::GetAccessibilityWindowInfo(std::vector>& infos) { WLOGFI("GetAccessibilityWindowInfo Called."); - std::map>::iterator iter; + std::map>::iterator iter; for (iter = sceneSessionMap_.begin(); iter != sceneSessionMap_.end(); iter++) { FillWindowInfo(infos, iter->second); } return WMError::WM_OK; } -void SceneSessionManager::NotifyWindowInfoChange(uint64_t persistentId, WindowUpdateType type) +void SceneSessionManager::NotifyWindowInfoChange(uint32_t persistentId, WindowUpdateType type) { std::vector> infos; auto iter = sceneSessionMap_.find(persistentId); if (iter == sceneSessionMap_.end()) { - WLOGFW("Error find session for id = %{public}" PRIu64, persistentId); + WLOGFW("Error find session for id = %{public}" PRIu32, persistentId); return; } @@ -1908,7 +1908,7 @@ void SceneSessionManager::FillWindowInfo(std::vector info = new (std::nothrow) AccessibilityWindowInfo(); - info->wid_ = static_cast(sceneSession->GetPersistentId()); + info->wid_ = static_cast(sceneSession->GetPersistentId()); WSRect wsrect = sceneSession->GetSessionRect(); info->windowRect_ = {wsrect.posX_, wsrect.posY_, wsrect.width_, wsrect.height_ }; info->focused_ = sceneSession->GetPersistentId() == focusedSessionId_; @@ -1923,9 +1923,9 @@ void SceneSessionManager::FillWindowInfo(std::vector &token) { - WLOGFI("run GetFocusSessionToken with focusedSessionId: %{public}" PRIu64, focusedSessionId_); + WLOGFI("run GetFocusSessionToken with focusedSessionId: %{public}" PRIu32, focusedSessionId_); auto sceneSession = GetSceneSession(focusedSessionId_); if (sceneSession) { token = sceneSession->GetAbilityToken(); @@ -2113,9 +2113,9 @@ WSError SceneSessionManager::GetFocusSessionToken(sptr &token) return WSError::WS_ERROR_INVALID_PARAM; } -WSError SceneSessionManager::UpdateSessionAvoidAreaListener(uint64_t& persistentId, bool haveListener) +WSError SceneSessionManager::UpdateSessionAvoidAreaListener(uint32_t& persistentId, bool haveListener) { - WLOGFI("UpdateSessionAvoidAreaListener persistentId: %{public}" PRIu64 " haveListener:%{public}d", + WLOGFI("UpdateSessionAvoidAreaListener persistentId: %{public}" PRIu32 " haveListener:%{public}d", persistentId, haveListener); auto sceneSession = GetSceneSession(persistentId); if (sceneSession == nullptr) { @@ -2131,7 +2131,7 @@ WSError SceneSessionManager::UpdateSessionAvoidAreaListener(uint64_t& persistent return WSError::WS_OK; } -bool SceneSessionManager::UpdateSessionAvoidAreaIfNeed(const uint64_t& persistentId, +bool SceneSessionManager::UpdateSessionAvoidAreaIfNeed(const uint32_t& persistentId, const AvoidArea& avoidArea, AvoidAreaType avoidAreaType) { auto iter = lastUpdatedAvoidArea_.find(persistentId); @@ -2164,7 +2164,7 @@ bool SceneSessionManager::UpdateSessionAvoidAreaIfNeed(const uint64_t& persisten return needUpdate; } -bool SceneSessionManager::UpdateAvoidArea(const uint64_t& persistentId) +bool SceneSessionManager::UpdateAvoidArea(const uint32_t& persistentId) { bool needUpdate = true; auto sceneSession = GetSceneSession(persistentId); @@ -2189,7 +2189,7 @@ bool SceneSessionManager::UpdateAvoidArea(const uint64_t& persistentId) } } else { if (avoidAreaListenerSessionSet_.find(sceneSession) == avoidAreaListenerSessionSet_.end()) { - WLOGD("id:%{public}" PRIu64" is not in avoidAreaListenerNodes, don't update avoid area.", persistentId); + WLOGD("id:%{public}" PRIu32" is not in avoidAreaListenerNodes, don't update avoid area.", persistentId); return false; } uint32_t start = static_cast(AvoidAreaType::TYPE_SYSTEM); @@ -2203,4 +2203,4 @@ bool SceneSessionManager::UpdateAvoidArea(const uint64_t& persistentId) return needUpdate; } -} // namespace OHOS::Rosen \ No newline at end of file +} // namespace OHOS::Rosen diff --git a/window_scene/session_manager/src/session_manager.cpp b/window_scene/session_manager/src/session_manager.cpp index b5baca43c8..b80b9498c6 100644 --- a/window_scene/session_manager/src/session_manager.cpp +++ b/window_scene/session_manager/src/session_manager.cpp @@ -116,7 +116,7 @@ void SessionManager::InitSceneSessionManagerProxy() void SessionManager::CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) + sptr property, uint32_t& persistentId, sptr& session) { WLOGFD("CreateAndConnectSpecificSession"); GetSceneSessionManagerProxy(); @@ -128,7 +128,7 @@ void SessionManager::CreateAndConnectSpecificSession(const sptr& surfaceNode, property, persistentId, session); } -void SessionManager::DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) +void SessionManager::DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) { WLOGFD("DestroyAndDisconnectSpecificSession"); GetSceneSessionManagerProxy(); @@ -150,7 +150,7 @@ WMError SessionManager::UpdateProperty(sptr& property, WS return static_cast(sceneSessionManagerProxy_->UpdateProperty(property, action)); } -WMError SessionManager::SetSessionGravity(uint64_t persistentId, SessionGravity gravity, uint32_t percent) +WMError SessionManager::SetSessionGravity(uint32_t persistentId, SessionGravity gravity, uint32_t percent) { WLOGFD("SetWindowGravity"); InitSceneSessionManagerProxy(); diff --git a/window_scene/session_manager/src/zidl/scene_session_manager_proxy.cpp b/window_scene/session_manager/src/zidl/scene_session_manager_proxy.cpp index dbc9632f81..497b3bccfc 100644 --- a/window_scene/session_manager/src/zidl/scene_session_manager_proxy.cpp +++ b/window_scene/session_manager/src/zidl/scene_session_manager_proxy.cpp @@ -30,7 +30,7 @@ constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "SceneSe } WSError SceneSessionManagerProxy::CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) + sptr property, uint32_t& persistentId, sptr& session) { MessageOption option(MessageOption::TF_SYNC); MessageParcel data; @@ -70,7 +70,7 @@ WSError SceneSessionManagerProxy::CreateAndConnectSpecificSession(const sptr sessionObject = reply.ReadRemoteObject(); if (sessionObject == nullptr) { WLOGFE("ReadRemoteObject failed"); @@ -81,7 +81,7 @@ WSError SceneSessionManagerProxy::CreateAndConnectSpecificSession(const sptr(ret); } -WSError SceneSessionManagerProxy::DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) +WSError SceneSessionManagerProxy::DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) { MessageParcel data; MessageParcel reply; @@ -90,8 +90,8 @@ WSError SceneSessionManagerProxy::DestroyAndDisconnectSpecificSession(const uint WLOGFE("WriteInterfaceToken failed"); return WSError::WS_ERROR_IPC_FAILED; } - if (!data.WriteUint64(persistentId)) { - WLOGFE("Write uint64_t failed"); + if (!data.WriteUint32(persistentId)) { + WLOGFE("Write persistentId failed"); } if (Remote()->SendRequest(static_cast( SceneSessionManagerMessage::TRANS_ID_DESTROY_AND_DISCONNECT_SPECIFIC_SESSION), @@ -167,7 +167,7 @@ WSError SceneSessionManagerProxy::BindDialogTarget(uint64_t persistentId, sptr(ret); } -WSError SceneSessionManagerProxy::UpdateSessionAvoidAreaListener(uint64_t& persistentId, bool haveListener) +WSError SceneSessionManagerProxy::UpdateSessionAvoidAreaListener(uint32_t& persistentId, bool haveListener) { MessageParcel data; MessageParcel reply; @@ -177,7 +177,7 @@ WSError SceneSessionManagerProxy::UpdateSessionAvoidAreaListener(uint64_t& persi WLOGFE("WriteInterfaceToken failed"); return WSError::WS_ERROR_IPC_FAILED; } - if (!data.WriteUint64(persistentId)) { + if (!data.WriteUint32(persistentId)) { WLOGFE("Write persistentId failed"); return WSError::WS_ERROR_IPC_FAILED; } @@ -275,7 +275,7 @@ void SceneSessionManagerProxy::GetFocusWindowInfo(FocusChangeInfo& focusInfo) focusInfo = *info; } -WSError SceneSessionManagerProxy::SetSessionGravity(uint64_t persistentId, SessionGravity gravity, uint32_t percent) +WSError SceneSessionManagerProxy::SetSessionGravity(uint32_t persistentId, SessionGravity gravity, uint32_t percent) { MessageParcel data; MessageParcel reply; @@ -290,7 +290,7 @@ WSError SceneSessionManagerProxy::SetSessionGravity(uint64_t persistentId, Sessi WLOGFE("SendRequest failed"); return WSError::WS_ERROR_IPC_FAILED; } - if (!data.WriteUint64(persistentId)) { + if (!data.WriteUint32(persistentId)) { WLOGFE("Write PropertyChangeAction failed"); return WSError::WS_ERROR_IPC_FAILED; } @@ -599,4 +599,4 @@ WSError SceneSessionManagerProxy::GetSessionDumpInfo(const sptr ¶ info = reply.ReadString(); return static_cast(reply.ReadInt32()); } -} // namespace OHOS::Rosen \ No newline at end of file +} // namespace OHOS::Rosen diff --git a/window_scene/session_manager/src/zidl/scene_session_manager_stub.cpp b/window_scene/session_manager/src/zidl/scene_session_manager_stub.cpp index 8f751e2ae0..f47cc12a25 100644 --- a/window_scene/session_manager/src/zidl/scene_session_manager_stub.cpp +++ b/window_scene/session_manager/src/zidl/scene_session_manager_stub.cpp @@ -104,14 +104,14 @@ int SceneSessionManagerStub::HandleCreateAndConnectSpecificSession(MessageParcel } else { WLOGFW("Property not exist!"); } - uint64_t persistentId = INVALID_SESSION_ID; + auto persistentId = INVALID_SESSION_ID; sptr sceneSession; CreateAndConnectSpecificSession(sessionStage, eventChannel, surfaceNode, property, persistentId, sceneSession); if (sceneSession== nullptr) { return ERR_INVALID_STATE; } - reply.WriteUint64(persistentId); + reply.WriteUint32(persistentId); reply.WriteRemoteObject(sceneSession->AsObject()); reply.WriteUint32(static_cast(WSError::WS_OK)); return ERR_NONE; @@ -120,7 +120,7 @@ int SceneSessionManagerStub::HandleCreateAndConnectSpecificSession(MessageParcel int SceneSessionManagerStub::HandleDestroyAndDisconnectSpcificSession(MessageParcel &data, MessageParcel &reply) { WLOGFI("run HandleDestroyAndDisconnectSpcificSession!"); - uint64_t persistentId = data.ReadUint64(); + auto persistentId = data.ReadUint32(); const WSError& ret = DestroyAndDisconnectSpecificSession(persistentId); reply.WriteUint32(static_cast(ret)); return ERR_NONE; @@ -281,7 +281,7 @@ int SceneSessionManagerStub::HandleGetAccessibilityWindowInfo(MessageParcel &dat int SceneSessionManagerStub::HandleSetSessionGravity(MessageParcel &data, MessageParcel &reply) { WLOGFI("run HandleSetSessionGravity!"); - uint64_t persistentId = data.ReadUint64(); + auto persistentId = data.ReadUint32(); SessionGravity gravity = static_cast(data.ReadUint32()); uint32_t percent = data.ReadUint32(); WSError ret = SetSessionGravity(persistentId, gravity, percent); @@ -302,7 +302,7 @@ int SceneSessionManagerStub::HandleGetSessionDump(MessageParcel &data, MessagePa int SceneSessionManagerStub::HandleUpdateSessionAvoidAreaListener(MessageParcel& data, MessageParcel& reply) { - uint64_t persistentId = data.ReadUint64(); + auto persistentId = data.ReadUint32(); bool haveAvoidAreaListener = data.ReadBool(); WSError errCode = UpdateSessionAvoidAreaListener(persistentId, haveAvoidAreaListener); reply.WriteUint32(static_cast(errCode)); @@ -312,10 +312,10 @@ int SceneSessionManagerStub::HandleUpdateSessionAvoidAreaListener(MessageParcel& int SceneSessionManagerStub::HandleBindDialogTarget(MessageParcel &data, MessageParcel &reply) { WLOGFI("run HandleBindDialogTarget!"); - uint64_t persistentId = data.ReadUint64(); + auto persistentId = data.ReadUint64(); sptr remoteObject = data.ReadRemoteObject(); const WSError& ret = BindDialogTarget(persistentId, remoteObject); reply.WriteUint32(static_cast(ret)); return ERR_NONE; } -} // namespace OHOS::Rosen \ No newline at end of file +} // namespace OHOS::Rosen diff --git a/window_scene/session_manager/src/zidl/session_listener_proxy.cpp b/window_scene/session_manager/src/zidl/session_listener_proxy.cpp index 0f98f7f029..1ef3fe4824 100644 --- a/window_scene/session_manager/src/zidl/session_listener_proxy.cpp +++ b/window_scene/session_manager/src/zidl/session_listener_proxy.cpp @@ -17,7 +17,7 @@ namespace OHOS::Rosen { -void SessionListenerProxy::OnSessionLabelChange(int persistentId, const std::string &label) {} -void SessionListenerProxy::OnSessionIconChange(int persistentId, const std::shared_ptr &icon) {} +void SessionListenerProxy::OnSessionLabelChange(uint32_t persistentId, const std::string &label) {} +void SessionListenerProxy::OnSessionIconChange(uint32_t persistentId, const std::shared_ptr &icon) {} } // namespace OHOS::Rosen \ No newline at end of file diff --git a/window_scene/test/mock/mock_session.h b/window_scene/test/mock/mock_session.h index 5b7c66adae..881b6494c6 100644 --- a/window_scene/test/mock/mock_session.h +++ b/window_scene/test/mock/mock_session.h @@ -29,7 +29,7 @@ public: SystemSessionConfig& systemConfig, sptr property, sptr token)); MOCK_METHOD6(CreateAndConnectSpecificSession, WSError(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session)); + sptr property, uint32_t& persistentId, sptr& session)); MOCK_METHOD1(Foreground, WSError(sptr property)); MOCK_METHOD0(Background, WSError(void)); diff --git a/window_scene/test/unittest/session_test.cpp b/window_scene/test/unittest/session_test.cpp index 397295def6..c19cbf5b72 100644 --- a/window_scene/test/unittest/session_test.cpp +++ b/window_scene/test/unittest/session_test.cpp @@ -545,7 +545,7 @@ HWTEST_F(WindowSessionTest, DestroyAndDisconnectSpecificSession01, Function | Sm SessionInfo info; info.abilityName_ = "testSession1"; info.bundleName_ = "testSession3"; - uint64_t persistentId = 0; + uint32_t persistentId = 0; sptr scensession = new (std::nothrow) SceneSession(info, nullptr); EXPECT_NE(scensession, nullptr); auto result = scensession->DestroyAndDisconnectSpecificSession(persistentId); @@ -555,7 +555,7 @@ HWTEST_F(WindowSessionTest, DestroyAndDisconnectSpecificSession01, Function | Sm new (std::nothrow) SceneSession::SpecificSessionCallback(); EXPECT_NE(specificCallback_, nullptr); int resultValue = 0; - specificCallback_->onDestroy_ = [&resultValue](const uint64_t &persistentId) -> WSError + specificCallback_->onDestroy_ = [&resultValue](const uint32_t &persistentId) -> WSError { resultValue = 1; return WSError::WS_OK; @@ -579,7 +579,7 @@ HWTEST_F(WindowSessionTest, CreateAndConnectSpecificSession01, Function | SmallT sptr session_; auto surfaceNode_ = CreateRSSurfaceNode(); sptr property_ = nullptr; - uint64_t persistentId = 0; + uint32_t persistentId = 0; sptr mockSessionStage = new (std::nothrow) SessionStageMocker(); EXPECT_NE(mockSessionStage, nullptr); sptr specificCallback_ = @@ -630,7 +630,7 @@ HWTEST_F(WindowSessionTest, CreateAndConnectSpecificSession2, Function | SmallTe sptr session_; auto surfaceNode_ = CreateRSSurfaceNode(); sptr property_ = nullptr; - uint64_t persistentId = 0; + uint32_t persistentId = 0; sptr mockSessionStage = new (std::nothrow) SessionStageMocker(); EXPECT_NE(mockSessionStage, nullptr); sptr specificCallback_ = diff --git a/wm/include/window_adapter.h b/wm/include/window_adapter.h index 6d42fe0e62..0c2149beb7 100644 --- a/wm/include/window_adapter.h +++ b/wm/include/window_adapter.h @@ -83,7 +83,7 @@ public: virtual void SetMaximizeMode(MaximizeMode maximizeMode); virtual MaximizeMode GetMaximizeMode(); virtual void GetFocusWindowInfo(FocusChangeInfo& focusInfo); - virtual WMError UpdateSessionAvoidAreaListener(uint64_t& persistentId, bool haveListener); + virtual WMError UpdateSessionAvoidAreaListener(uint32_t& persistentId, bool haveListener); private: static inline SingletonDelegator delegator; bool InitWMSProxy(); diff --git a/wm/include/window_scene_session_impl.h b/wm/include/window_scene_session_impl.h index 3b95912b74..011c0113f5 100644 --- a/wm/include/window_scene_session_impl.h +++ b/wm/include/window_scene_session_impl.h @@ -102,7 +102,7 @@ protected: WMError CreateAndConnectSpecificSession(); sptr FindParentSessionByParentId(uint32_t parentId); sptr FindMainWindowWithContext(); - void UpdateSubWindowStateAndNotify(uint64_t parentPersistentId, const WindowState& newState); + void UpdateSubWindowStateAndNotify(uint32_t parentPersistentId, const WindowState& newState); void LimitCameraFloatWindowMininumSize(uint32_t& width, uint32_t& height); void UpdateFloatingWindowSizeBySizeLimits(uint32_t& width, uint32_t& height) const; WMError NotifyWindowSessionProperty(); diff --git a/wm/include/window_session_impl.h b/wm/include/window_session_impl.h index d029c1f887..0237260885 100644 --- a/wm/include/window_session_impl.h +++ b/wm/include/window_session_impl.h @@ -106,10 +106,10 @@ public: WMError SetBackgroundColor(const std::string& color) override; uint32_t GetParentId() const; - uint64_t GetPersistentId() const; + uint32_t GetPersistentId() const; sptr GetProperty() const; sptr GetHostSession() const; - uint64_t GetFloatingWindowParentId(); + uint32_t GetFloatingWindowParentId(); void NotifyAfterForeground(bool needNotifyListeners = true, bool needNotifyUiContent = true); void NotifyAfterBackground(bool needNotifyListeners = true, bool needNotifyUiContent = true); void NotifyForegroundFailed(WMError ret); @@ -130,7 +130,7 @@ protected: void NotifyAfterActive(); void NotifyAfterInactive(); void NotifyBeforeDestroy(std::string windowName); - void ClearListenersById(uint64_t persistentId); + void ClearListenersById(uint32_t persistentId); WMError WindowSessionCreateCheck(); void UpdateDecorEnable(bool needNotify = false); void NotifyModeChange(WindowMode mode, bool hasDeco = true); @@ -150,8 +150,8 @@ protected: NotifyNativeWinDestroyFunc notifyNativeFunc_; std::recursive_mutex mutex_; - static std::map>> windowSessionMap_; - static std::map>> subWindowSessionMap_; + static std::map>> windowSessionMap_; + static std::map>> subWindowSessionMap_; bool isIgnoreSafeAreaNeedNotify_ = false; bool isIgnoreSafeArea_ = false; @@ -169,7 +169,7 @@ private: EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); - template void ClearUselessListeners(std::map& listeners, uint64_t persistentId); + template void ClearUselessListeners(std::map& listeners, uint32_t persistentId); RSSurfaceNode::SharedPtr CreateSurfaceNode(std::string name, WindowType type); void NotifyAfterFocused(); void NotifyAfterUnfocused(bool needNotifyUiContent = true); @@ -177,11 +177,11 @@ private: void NotifySizeChange(Rect rect, WindowSizeChangeReason reason); static std::recursive_mutex globalMutex_; - static std::map>> lifecycleListeners_; - static std::map>> windowChangeListeners_; - static std::map>> avoidAreaChangeListeners_; - static std::map>> dialogDeathRecipientListeners_; - static std::map>> dialogTargetTouchListener_; + static std::map>> lifecycleListeners_; + static std::map>> windowChangeListeners_; + static std::map>> avoidAreaChangeListeners_; + static std::map>> dialogDeathRecipientListeners_; + static std::map>> dialogTargetTouchListener_; static std::map>> occupiedAreaChangeListeners_; std::optional> focusState_ = std::nullopt; diff --git a/wm/src/window_adapter.cpp b/wm/src/window_adapter.cpp index 8c750d1b5e..f989a66b49 100644 --- a/wm/src/window_adapter.cpp +++ b/wm/src/window_adapter.cpp @@ -376,7 +376,7 @@ void WindowAdapter::GetFocusWindowInfo(FocusChangeInfo& focusInfo) return windowManagerServiceProxy_->GetFocusWindowInfo(focusInfo); } -WMError WindowAdapter::UpdateSessionAvoidAreaListener(uint64_t& persistentId, bool haveListener) +WMError WindowAdapter::UpdateSessionAvoidAreaListener(uint32_t& persistentId, bool haveListener) { INIT_PROXY_CHECK_RETURN(WMError::WM_DO_NOTHING); return static_cast(windowManagerServiceProxy_->UpdateSessionAvoidAreaListener(persistentId, haveListener)); diff --git a/wm/src/window_extension_session_impl.cpp b/wm/src/window_extension_session_impl.cpp index 227f4343d4..8d9e95e491 100644 --- a/wm/src/window_extension_session_impl.cpp +++ b/wm/src/window_extension_session_impl.cpp @@ -49,7 +49,7 @@ WMError WindowExtensionSessionImpl::Create(const std::shared_ptrGetPersistentId(), x, y); + WLOGFD("Id:%{public}" PRIu32 " MoveTo %{public}d %{public}d", property_->GetPersistentId(), x, y); if (IsWindowSessionInvalid()) { WLOGFE("Window session invalid."); return WMError::WM_ERROR_INVALID_WINDOW; @@ -62,7 +62,7 @@ WMError WindowExtensionSessionImpl::MoveTo(int32_t x, int32_t y) WMError WindowExtensionSessionImpl::Resize(uint32_t width, uint32_t height) { - WLOGFD("Id:%{public}" PRIu64 " Resize %{public}u %{public}u", property_->GetPersistentId(), width, height); + WLOGFD("Id:%{public}" PRIu32 " Resize %{public}u %{public}u", property_->GetPersistentId(), width, height); if (IsWindowSessionInvalid()) { WLOGFE("Window session invalid."); return WMError::WM_ERROR_INVALID_WINDOW; @@ -76,7 +76,7 @@ WMError WindowExtensionSessionImpl::Resize(uint32_t width, uint32_t height) WMError WindowExtensionSessionImpl::TransferAbilityResult(uint32_t resultCode, const AAFwk::Want& want) { if (state_ < WindowState::STATE_CREATED) { - WLOGFE("Extension invalid [name:%{public}s, id:%{public}" PRIu64 "], state:%{public}u", + WLOGFE("Extension invalid [name:%{public}s, id:%{public}" PRIu32 "], state:%{public}u", property_->GetWindowName().c_str(), property_->GetPersistentId(), state_); return WMError::WM_ERROR_REPEAT_OPERATION; } @@ -86,7 +86,7 @@ WMError WindowExtensionSessionImpl::TransferAbilityResult(uint32_t resultCode, c WMError WindowExtensionSessionImpl::TransferExtensionData(const AAFwk::WantParams& wantParams) { if (state_ < WindowState::STATE_CREATED) { - WLOGFE("Extension invalid [name:%{public}s, id:%{public}" PRIu64 "], state:%{public}u", + WLOGFE("Extension invalid [name:%{public}s, id:%{public}" PRIu32 "], state:%{public}u", property_->GetWindowName().c_str(), property_->GetPersistentId(), state_); return WMError::WM_ERROR_REPEAT_OPERATION; } @@ -96,7 +96,7 @@ WMError WindowExtensionSessionImpl::TransferExtensionData(const AAFwk::WantParam void WindowExtensionSessionImpl::RegisterTransferComponentDataListener(const NotifyTransferComponentDataFunc& func) { if (state_ < WindowState::STATE_CREATED) { - WLOGFE("Extension invalid [name:%{public}s, id:%{public}" PRIu64 "], state:%{public}u", + WLOGFE("Extension invalid [name:%{public}s, id:%{public}" PRIu32 "], state:%{public}u", property_->GetWindowName().c_str(), property_->GetPersistentId(), state_); return; } diff --git a/wm/src/window_scene_session_impl.cpp b/wm/src/window_scene_session_impl.cpp index 02cc16f5e3..f26745ed3a 100644 --- a/wm/src/window_scene_session_impl.cpp +++ b/wm/src/window_scene_session_impl.cpp @@ -83,10 +83,10 @@ bool WindowSceneSessionImpl::IsValidSystemWindowType(const WindowType& type) sptr WindowSceneSessionImpl::FindParentSessionByParentId(uint32_t parentId) { for (const auto& item : windowSessionMap_) { - if (item.second.second && item.second.second->GetProperty() && - item.second.second->GetWindowId() == parentId && + if (item.second.second && item.second.second->GetProperty() && item.second.second->GetWindowId() == parentId && WindowHelper::IsMainWindow(item.second.second->GetType())) { - WLOGFD("Find parent, [parentName: %{public}s, parentId:%{public}u, selfPersistentId: %{public}" PRIu64"]", + WLOGFD("Find parent, [parentName: %{public}s, parentId:%{public}" PRIu32 + ", selfPersistentId: %{public}" PRIu32"]", item.second.second->GetProperty()->GetWindowName().c_str(), parentId, GetProperty()->GetPersistentId()); return item.second.second; } @@ -116,7 +116,7 @@ WMError WindowSceneSessionImpl::CreateAndConnectSpecificSession() return WMError::WM_ERROR_NULLPTR; } sptr eventChannel(channel); - uint64_t persistentId = INVALID_SESSION_ID; + auto persistentId = INVALID_SESSION_ID; sptr session; if (WindowHelper::IsSubWindow(GetType())) { // sub window auto parentSession = FindParentSessionByParentId(property_->GetParentId()); @@ -133,7 +133,7 @@ WMError WindowSceneSessionImpl::CreateAndConnectSpecificSession() } else { // system window if (WindowHelper::IsAppFloatingWindow(GetType())) { property_->SetParentPersistentId(GetFloatingWindowParentId()); - WLOGFI("property_ set parentPersistentId: %{public}" PRIu64 "", property_->GetParentPersistentId()); + WLOGFI("property_ set parentPersistentId: %{public}" PRIu32 "", property_->GetParentPersistentId()); } if (GetType() == WindowType::WINDOW_TYPE_DIALOG) { auto mainWindow = FindMainWindowWithContext(); @@ -153,7 +153,7 @@ WMError WindowSceneSessionImpl::CreateAndConnectSpecificSession() } else { return WMError::WM_ERROR_NULLPTR; } - WLOGFI("CreateAndConnectSpecificSession [name:%{public}s, id:%{public}" PRIu64 ", type: %{public}u]", + WLOGFI("CreateAndConnectSpecificSession [name:%{public}s, id:%{public}" PRIu32 ", type: %{public}u]", property_->GetWindowName().c_str(), property_->GetPersistentId(), GetType()); return WMError::WM_OK; } @@ -198,7 +198,7 @@ WMError WindowSceneSessionImpl::Create(const std::shared_ptrGetWindowName().c_str(), property_->GetPersistentId(), state_, windowMode_); return ret; } @@ -322,16 +322,16 @@ void WindowSceneSessionImpl::UpdateWindowSizeLimits() property_->SetWindowLimits(newLimits); } -void WindowSceneSessionImpl::UpdateSubWindowStateAndNotify(uint64_t parentPersistentId, const WindowState& newState) +void WindowSceneSessionImpl::UpdateSubWindowStateAndNotify(uint32_t parentPersistentId, const WindowState& newState) { auto iter = subWindowSessionMap_.find(parentPersistentId); if (iter == subWindowSessionMap_.end()) { - WLOGFD("main window: %{public}" PRIu64" has no child node", parentPersistentId); + WLOGFD("main window: %{public}" PRIu32" has no child node", parentPersistentId); return; } const auto& subWindows = iter->second; if (subWindows.empty()) { - WLOGFD("main window: %{public}" PRIu64", its subWindowMap is empty", parentPersistentId); + WLOGFD("main window: %{public}" PRIu32", its subWindowMap is empty", parentPersistentId); return; } @@ -356,14 +356,14 @@ void WindowSceneSessionImpl::UpdateSubWindowStateAndNotify(uint64_t parentPersis WMError WindowSceneSessionImpl::Show(uint32_t reason, bool withAnimation) { - WLOGFI("Window Show [name:%{public}s, id:%{public}" PRIu64 ", type:%{public}u], reason:%{public}u state:%{pubic}u", + WLOGFI("Window Show [name:%{public}s, id:%{public}" PRIu32 ", type:%{public}u], reason:%{public}u state:%{pubic}u", property_->GetWindowName().c_str(), property_->GetPersistentId(), GetType(), reason, state_); if (IsWindowSessionInvalid()) { WLOGFE("session is invalid"); return WMError::WM_ERROR_INVALID_WINDOW; } if (state_ == WindowState::STATE_SHOWN) { - WLOGFD("window session is alreay shown [name:%{public}s, id:%{public}" PRIu64 ", type: %{public}u]", + WLOGFD("window session is alreay shown [name:%{public}s, id:%{public}" PRIu32 ", type: %{public}u]", property_->GetWindowName().c_str(), property_->GetPersistentId(), GetType()); return WMError::WM_OK; } @@ -391,14 +391,14 @@ WMError WindowSceneSessionImpl::Show(uint32_t reason, bool withAnimation) WMError WindowSceneSessionImpl::Hide(uint32_t reason, bool withAnimation, bool isFromInnerkits) { - WLOGFI("id:%{public}" PRIu64 " Hide, reason:%{public}u, state:%{public}u", + WLOGFI("id:%{public}" PRIu32 " Hide, reason:%{public}u, state:%{public}u", property_->GetPersistentId(), reason, state_); if (IsWindowSessionInvalid()) { WLOGFE("session is invalid"); return WMError::WM_ERROR_INVALID_WINDOW; } if (state_ == WindowState::STATE_HIDDEN || state_ == WindowState::STATE_CREATED) { - WLOGFD("window session is alreay hidden [name:%{public}s, id:%{public}" PRIu64 ", type: %{public}u]", + WLOGFD("window session is alreay hidden [name:%{public}s, id:%{public}" PRIu32 ", type: %{public}u]", property_->GetWindowName().c_str(), property_->GetPersistentId(), GetType()); return WMError::WM_OK; } @@ -474,13 +474,13 @@ WSError WindowSceneSessionImpl::SetActive(bool active) void WindowSceneSessionImpl::DestroySubWindow() { for (auto elem : subWindowSessionMap_) { - WLOGFE("Id: %{public}" PRIu64 ", size: %{public}zu", elem.first, subWindowSessionMap_.size()); + WLOGFE("Id: %{public}" PRIu32 ", size: %{public}zu", elem.first, subWindowSessionMap_.size()); } - const uint64_t& parentPersistentId = property_->GetParentPersistentId(); - const uint64_t& persistentId = GetPersistentId(); + const uint32_t& parentPersistentId = property_->GetParentPersistentId(); + const uint32_t& persistentId = GetPersistentId(); - WLOGFD("Id: %{public}" PRIu64 ", parentId: %{public}" PRIu64 "", persistentId, parentPersistentId); + WLOGFD("Id: %{public}" PRIu32 ", parentId: %{public}" PRIu32 "", persistentId, parentPersistentId); // remove from subWindowMap_ when destroy sub window auto subIter = subWindowSessionMap_.find(parentPersistentId); @@ -492,7 +492,7 @@ void WindowSceneSessionImpl::DestroySubWindow() continue; } if ((*iter)->GetPersistentId() == persistentId) { - WLOGFD("Destroy sub window, persistentId: %{public}" PRIu64 "", persistentId); + WLOGFD("Destroy sub window, persistentId: %{public}" PRIu32 "", persistentId); iter = subWindows.erase(iter); break; } @@ -509,7 +509,7 @@ void WindowSceneSessionImpl::DestroySubWindow() iter = subWindows.erase(iter); continue; } - WLOGFD("Destroy sub window, persistentId: %{public}" PRIu64 "", (*iter)->GetPersistentId()); + WLOGFD("Destroy sub window, persistentId: %{public}" PRIu32 "", (*iter)->GetPersistentId()); (*iter)->Destroy(false); iter++; } @@ -520,7 +520,7 @@ void WindowSceneSessionImpl::DestroySubWindow() WMError WindowSceneSessionImpl::Destroy(bool needClearListener) { - WLOGFI("Id:%{public}" PRIu64 " Destroy, state_:%{public}u", property_->GetPersistentId(), state_); + WLOGFI("Id:%{public}" PRIu32 " Destroy, state_:%{public}u", property_->GetPersistentId(), state_); if (IsWindowSessionInvalid()) { WLOGFE("session is invalid"); return WMError::WM_OK; @@ -557,7 +557,7 @@ WMError WindowSceneSessionImpl::Destroy(bool needClearListener) WMError WindowSceneSessionImpl::MoveTo(int32_t x, int32_t y) { - WLOGFD("Id:%{public}" PRIu64 " MoveTo %{public}d %{public}d", property_->GetPersistentId(), x, y); + WLOGFD("Id:%{public}" PRIu32 " MoveTo %{public}d %{public}d", property_->GetPersistentId(), x, y); if (IsWindowSessionInvalid()) { return WMError::WM_ERROR_INVALID_WINDOW; } @@ -565,7 +565,7 @@ WMError WindowSceneSessionImpl::MoveTo(int32_t x, int32_t y) Rect newRect = { x, y, rect.width_, rect.height_ }; // must keep x/y property_->SetRequestRect(newRect); if (state_ == WindowState::STATE_HIDDEN || state_ < WindowState::STATE_CREATED) { - WLOGFD("Window is hidden or not created! id: %{public}" PRIu64 ", oriPos: [%{public}d, %{public}d, " + WLOGFD("Window is hidden or not created! id: %{public}" PRIu32 ", oriPos: [%{public}d, %{public}d, " "movePos: [%{public}d, %{public}d]", property_->GetPersistentId(), rect.posX_, rect.posY_, x, y); return WMError::WM_OK; } @@ -657,7 +657,7 @@ void WindowSceneSessionImpl::UpdateFloatingWindowSizeBySizeLimits(uint32_t& widt WMError WindowSceneSessionImpl::Resize(uint32_t width, uint32_t height) { - WLOGFD("Id:%{public}" PRIu64 " Resize %{public}u %{public}u", property_->GetPersistentId(), width, height); + WLOGFD("Id:%{public}" PRIu32 " Resize %{public}u %{public}u", property_->GetPersistentId(), width, height); if (IsWindowSessionInvalid()) { return WMError::WM_ERROR_INVALID_WINDOW; } @@ -670,7 +670,7 @@ WMError WindowSceneSessionImpl::Resize(uint32_t width, uint32_t height) Rect newRect = { rect.posX_, rect.posY_, width, height }; // must keep w/h property_->SetRequestRect(newRect); if (state_ == WindowState::STATE_HIDDEN || state_ < WindowState::STATE_CREATED) { - WLOGFD("Window is hidden or not created! id: %{public}" PRIu64 ", oriSize: [%{public}u, %{public}u, " + WLOGFD("Window is hidden or not created! id: %{public}" PRIu32 ", oriSize: [%{public}u, %{public}u, " "newSize [%{public}u, %{public}u], state: %{public}u", property_->GetPersistentId(), rect.width_, rect.height_, width, height, static_cast(state_)); return WMError::WM_OK; @@ -1442,7 +1442,7 @@ void WindowSceneSessionImpl::SetNeedDefaultAnimation(bool needDefaultAnimation) WMError WindowSceneSessionImpl::SetTransform(const Transform& trans) { - WLOGFI("property_ persistentId: %{public}" PRIu64 "", property_->GetPersistentId()); + WLOGFI("property_ persistentId: %{public}" PRIu32 "", property_->GetPersistentId()); if (IsWindowSessionInvalid()) { return WMError::WM_ERROR_INVALID_WINDOW; } @@ -1504,16 +1504,16 @@ WMError WindowSceneSessionImpl::RegisterAnimationTransitionController( // CustomAnimation is enabled when animationTransitionController_ exists animationTransitionController->AnimationForShown(); } - WLOGFI("AnimationForShown excute sucess %{public}" PRIu64"!", property->GetPersistentId()); + WLOGFI("AnimationForShown excute sucess %{public}" PRIu32"!", property->GetPersistentId()); }); } - WLOGI("RegisterAnimationTransitionController %{public}" PRIu64"!", property_->GetPersistentId()); + WLOGI("RegisterAnimationTransitionController %{public}" PRIu32"!", property_->GetPersistentId()); return WMError::WM_OK; } WMError WindowSceneSessionImpl::UpdateSurfaceNodeAfterCustomAnimation(bool isAdd) { - WLOGFI("id: %{public}" PRIu64" , isAdd:%{public}u", property_->GetPersistentId(), isAdd); + WLOGFI("id: %{public}" PRIu32" , isAdd:%{public}u", property_->GetPersistentId(), isAdd); if (IsWindowSessionInvalid()) { return WMError::WM_ERROR_INVALID_WINDOW; } @@ -1565,7 +1565,7 @@ WMError WindowSceneSessionImpl::UpdateAnimationFlagProperty(bool withAnimation) WMError WindowSceneSessionImpl::SetAlpha(float alpha) { - WLOGI("Window %{public}" PRIu64" alpha %{public}f", property_->GetPersistentId(), alpha); + WLOGI("Window %{public}" PRIu32" alpha %{public}f", property_->GetPersistentId(), alpha); if (!SessionPermission::IsSystemCalling() && !SessionPermission::IsStartByHdcd()) { WLOGFE("set alpha permission denied!"); return WMError::WM_ERROR_NOT_SYSTEM_APP; @@ -1580,7 +1580,7 @@ WMError WindowSceneSessionImpl::SetAlpha(float alpha) WMError WindowSceneSessionImpl::BindDialogTarget(sptr targetToken) { - uint32_t persistentId = property_->GetPersistentId(); + auto persistentId = property_->GetPersistentId(); WMError ret = SessionManager::GetInstance().BindDialogTarget(persistentId, targetToken); if (ret != WMError::WM_OK) { WLOGFE("bind window failed with errCode:%{public}d", static_cast(ret)); diff --git a/wm/src/window_session_impl.cpp b/wm/src/window_session_impl.cpp index 655a2674ca..d8e82c543a 100755 --- a/wm/src/window_session_impl.cpp +++ b/wm/src/window_session_impl.cpp @@ -42,15 +42,15 @@ namespace Rosen { namespace { constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowSessionImpl"}; } -std::map>> WindowSessionImpl::lifecycleListeners_; -std::map>> WindowSessionImpl::windowChangeListeners_; -std::map>> WindowSessionImpl::avoidAreaChangeListeners_; -std::map>> WindowSessionImpl::dialogDeathRecipientListeners_; -std::map>> WindowSessionImpl::dialogTargetTouchListener_; +std::map>> WindowSessionImpl::lifecycleListeners_; +std::map>> WindowSessionImpl::windowChangeListeners_; +std::map>> WindowSessionImpl::avoidAreaChangeListeners_; +std::map>> WindowSessionImpl::dialogDeathRecipientListeners_; +std::map>> WindowSessionImpl::dialogTargetTouchListener_; std::map>> WindowSessionImpl::occupiedAreaChangeListeners_; std::recursive_mutex WindowSessionImpl::globalMutex_; -std::map>> WindowSessionImpl::windowSessionMap_; -std::map>> WindowSessionImpl::subWindowSessionMap_; +std::map>> WindowSessionImpl::windowSessionMap_; +std::map>> WindowSessionImpl::subWindowSessionMap_; #define CALL_LIFECYCLE_LISTENER(windowLifecycleCb, listeners) \ do { \ @@ -121,7 +121,7 @@ RSSurfaceNode::SharedPtr WindowSessionImpl::CreateSurfaceNode(std::string name, WindowSessionImpl::~WindowSessionImpl() { - WLOGFD("~WindowSessionImpl, id: %{public}" PRIu64"", GetPersistentId()); + WLOGFD("~WindowSessionImpl, id: %{public}" PRIu32"", GetPersistentId()); Destroy(false); } @@ -140,12 +140,12 @@ bool WindowSessionImpl::IsWindowSessionInvalid() const bool res = ((hostSession_ == nullptr) || (GetPersistentId() == INVALID_SESSION_ID) || (state_ == WindowState::STATE_DESTROYED)); if (res) { - WLOGW("already destroyed or not created! id: %{public}" PRIu64" state_: %{public}u", GetPersistentId(), state_); + WLOGW("already destroyed or not created! id: %{public}" PRIu32" state_: %{public}u", GetPersistentId(), state_); } return res; } -uint64_t WindowSessionImpl::GetPersistentId() const +uint32_t WindowSessionImpl::GetPersistentId() const { if (property_) { return property_->GetPersistentId(); @@ -212,21 +212,21 @@ WMError WindowSessionImpl::Connect() } auto ret = hostSession_->Connect( iSessionStage, iWindowEventChannel, surfaceNode_, windowSystemConfig_, property_, token); - WLOGFI("Window Connect [name:%{public}s, id:%{public}" PRIu64 ", type:%{public}u], ret:%{public}u", + WLOGFI("Window Connect [name:%{public}s, id:%{public}" PRIu32 ", type:%{public}u], ret:%{public}u", property_->GetWindowName().c_str(), GetPersistentId(), property_->GetWindowType(), ret); return static_cast(ret); } WMError WindowSessionImpl::Show(uint32_t reason, bool withAnimation) { - WLOGFI("Window Show [name:%{public}s, id:%{public}" PRIu64 ", type:%{public}u], reason:%{public}u state:%{pubic}u", + WLOGFI("Window Show [name:%{public}s, id:%{public}" PRIu32 ", type:%{public}u], reason:%{public}u state:%{pubic}u", property_->GetWindowName().c_str(), GetPersistentId(), property_->GetWindowType(), reason, state_); if (IsWindowSessionInvalid()) { WLOGFE("session is invalid"); return WMError::WM_ERROR_INVALID_WINDOW; } if (state_ == WindowState::STATE_SHOWN) { - WLOGFD("window session is alreay shown [name:%{public}s, id:%{public}" PRIu64 ", type: %{public}u]", + WLOGFD("window session is alreay shown [name:%{public}s, id:%{public}" PRIu32 ", type: %{public}u]", property_->GetWindowName().c_str(), GetPersistentId(), property_->GetWindowType()); return WMError::WM_OK; } @@ -245,14 +245,14 @@ WMError WindowSessionImpl::Show(uint32_t reason, bool withAnimation) WMError WindowSessionImpl::Hide(uint32_t reason, bool withAnimation, bool isFromInnerkits) { - WLOGFI("id:%{public}" PRIu64 " Hide, reason:%{public}u, state:%{public}u", + WLOGFI("id:%{public}" PRIu32 " Hide, reason:%{public}u, state:%{public}u", GetPersistentId(), reason, state_); if (IsWindowSessionInvalid()) { WLOGFE("session is invalid"); return WMError::WM_ERROR_INVALID_WINDOW; } if (state_ == WindowState::STATE_HIDDEN || state_ == WindowState::STATE_CREATED) { - WLOGFD("window session is alreay hidden [name:%{public}s, id:%{public}" PRIu64 ", type: %{public}u]", + WLOGFD("window session is alreay hidden [name:%{public}s, id:%{public}" PRIu32 ", type: %{public}u]", property_->GetWindowName().c_str(), GetPersistentId(), property_->GetWindowType()); NotifyBackgroundFailed(WMError::WM_DO_NOTHING); return WMError::WM_OK; @@ -264,7 +264,7 @@ WMError WindowSessionImpl::Hide(uint32_t reason, bool withAnimation, bool isFrom WMError WindowSessionImpl::Destroy(bool needClearListener) { - WLOGFI("Id:%{public}" PRIu64 " Destroy, state_:%{public}u", GetPersistentId(), state_); + WLOGFI("Id:%{public}" PRIu32 " Destroy, state_:%{public}u", GetPersistentId(), state_); if (IsWindowSessionInvalid()) { WLOGFE("session is invalid"); return WMError::WM_ERROR_INVALID_WINDOW; @@ -351,11 +351,11 @@ void WindowSessionImpl::UpdateViewportConfig(const Rect& rect, WindowSizeChangeR float density = display->GetDisplayInfo()->GetVirtualPixelRatio(); config.SetDensity(density); uiContent_->UpdateViewportConfig(config, reason); - WLOGFD("Id:%{public}" PRIu64 ", windowRect:[%{public}d, %{public}d, %{public}u, %{public}u]", + WLOGFD("Id:%{public}" PRIu32 ", windowRect:[%{public}d, %{public}d, %{public}u, %{public}u]", GetPersistentId(), rect.posX_, rect.posY_, rect.width_, rect.height_); } -uint64_t WindowSessionImpl::GetFloatingWindowParentId() +uint32_t WindowSessionImpl::GetFloatingWindowParentId() { if (context_.get() == nullptr) { return INVALID_SESSION_ID; @@ -365,7 +365,7 @@ uint64_t WindowSessionImpl::GetFloatingWindowParentId() if (winPair.second.second && WindowHelper::IsMainWindow(winPair.second.second->GetType()) && winPair.second.second->GetProperty() && context_.get() == winPair.second.second->GetContext().get()) { - WLOGFD("Find parent, [parentName: %{public}s, selfPersistentId: %{public}" PRIu64"]", + WLOGFD("Find parent, [parentName: %{public}s, selfPersistentId: %{public}" PRIu32"]", winPair.second.second->GetProperty()->GetWindowName().c_str(), GetPersistentId()); return winPair.second.second->GetProperty()->GetPersistentId(); } @@ -409,7 +409,7 @@ WMError WindowSessionImpl::SetUIContent(const std::string& contentInfo, uiContent = Ace::UIContent::Create(context_.get(), engine); } if (uiContent == nullptr) { - WLOGFE("fail to SetUIContent id: %{public}" PRIu64 "", GetPersistentId()); + WLOGFE("fail to SetUIContent id: %{public}" PRIu32 "", GetPersistentId()); return WMError::WM_ERROR_NULLPTR; } if (isdistributed) { @@ -578,7 +578,7 @@ std::string WindowSessionImpl::GetContentInfo() { WLOGFD("GetContentInfo"); if (uiContent_ == nullptr) { - WLOGFE("fail to GetContentInfo id: %{public}" PRIu64 "", GetPersistentId()); + WLOGFE("fail to GetContentInfo id: %{public}" PRIu32 "", GetPersistentId()); return ""; } return uiContent_->GetContentInfo(); @@ -591,7 +591,7 @@ Ace::UIContent* WindowSessionImpl::GetUIContent() const void WindowSessionImpl::OnNewWant(const AAFwk::Want& want) { - WLOGFI("Window [name:%{public}s, id:%{public}" PRIu64 "]", + WLOGFI("Window [name:%{public}s, id:%{public}" PRIu32 "]", property_->GetWindowName().c_str(), GetPersistentId()); if (uiContent_ != nullptr) { uiContent_->OnNewWant(want); @@ -735,12 +735,12 @@ WMError WindowSessionImpl::UnregisterListener(std::vector>& holder, cons } template -void WindowSessionImpl::ClearUselessListeners(std::map& listeners, uint64_t persistentId) +void WindowSessionImpl::ClearUselessListeners(std::map& listeners, uint32_t persistentId) { listeners.erase(persistentId); } -void WindowSessionImpl::ClearListenersById(uint64_t persistentId) +void WindowSessionImpl::ClearListenersById(uint32_t persistentId) { std::lock_guard lock(globalMutex_); ClearUselessListeners(lifecycleListeners_, persistentId); @@ -945,7 +945,7 @@ WMError WindowSessionImpl::RegisterAvoidAreaChangeListener(sptr lock(globalMutex_); WMError ret = RegisterListener(avoidAreaChangeListeners_[persistentId], listener); if (ret != WMError::WM_OK) { @@ -960,7 +960,7 @@ WMError WindowSessionImpl::RegisterAvoidAreaChangeListener(sptr& listener) { WLOGFD("Start unregister"); - uint64_t persistentId = GetPersistentId(); + auto persistentId = GetPersistentId(); if (listener == nullptr) { WLOGFE("listener is nullptr"); return WMError::WM_ERROR_NULLPTR; @@ -1002,7 +1002,7 @@ void WindowSessionImpl::NotifyAvoidAreaChange(const sptr& avoidArea, WSError WindowSessionImpl::UpdateAvoidArea(const sptr& avoidArea, AvoidAreaType type) { - WLOGI("UpdateAvoidArea, id:%{public}" PRIu64, GetPersistentId()); + WLOGI("UpdateAvoidArea, id:%{public}" PRIu32, GetPersistentId()); NotifyAvoidAreaChange(avoidArea, type); return WSError::WS_OK; } diff --git a/wmserver/include/zidl/window_manager_interface.h b/wmserver/include/zidl/window_manager_interface.h index 008d3d34c1..d1195456fb 100644 --- a/wmserver/include/zidl/window_manager_interface.h +++ b/wmserver/include/zidl/window_manager_interface.h @@ -128,7 +128,7 @@ public: virtual void SetMaximizeMode(MaximizeMode maximizeMode) = 0; virtual MaximizeMode GetMaximizeMode() = 0; virtual void GetFocusWindowInfo(FocusChangeInfo& focusInfo) = 0; - virtual WSError UpdateSessionAvoidAreaListener(uint64_t& persistentId, bool haveListener) { return WSError::WS_OK; } + virtual WSError UpdateSessionAvoidAreaListener(uint32_t& persistentId, bool haveListener) { return WSError::WS_OK; } }; } } -- Gitee From 876ace02897936136e0f8c86470ba130b7a60f3a Mon Sep 17 00:00:00 2001 From: nickyhey Date: Wed, 19 Jul 2023 16:08:10 +0800 Subject: [PATCH 2/8] =?UTF-8?q?SCB=20=20session=E3=80=81window=E3=80=81mis?= =?UTF-8?q?sion=20ID=E5=BD=92=E4=B8=80=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nickyhey --- .../common/include/window_session_property.h | 12 +- .../common/src/window_session_property.cpp | 16 +-- .../dfx/include/dfx_hisysevent.h | 2 +- .../dfx/src/dfx_hisysevent.cpp | 2 +- .../service/anr_manager/include/anr_manager.h | 18 +-- .../service/anr_manager/src/anr_manager.cpp | 36 +++--- .../service/event_stage/include/event_stage.h | 14 +-- .../service/event_stage/src/event_stage.cpp | 18 +-- .../src/intention_event_manager.cpp | 2 +- window_scene/interfaces/include/ws_common.h | 6 +- .../js_scene_session.cpp | 4 +- .../js_scene_session_manager.cpp | 8 +- .../scene_session_manager/js_scene_utils.cpp | 6 +- .../host/include/move_drag_controller.h | 4 +- .../session/host/include/scene_persistence.h | 8 +- .../session/host/include/scene_session.h | 8 +- window_scene/session/host/include/session.h | 14 +-- .../host/include/zidl/session_interface.h | 4 +- .../session/host/include/zidl/session_proxy.h | 4 +- .../session/host/src/move_drag_controller.cpp | 4 +- .../session/host/src/scene_persistence.cpp | 6 +- .../session/host/src/scene_session.cpp | 16 +-- window_scene/session/host/src/session.cpp | 49 +++++---- .../session/host/src/zidl/session_proxy.cpp | 14 +-- .../session/host/src/zidl/session_stub.cpp | 10 +- .../include/extension_session_manager.h | 2 +- .../include/scene_session_manager.h | 44 ++++---- .../session_manager/include/session_manager.h | 6 +- .../zidl/scene_session_manager_interface.h | 6 +- .../zidl/scene_session_manager_proxy.h | 10 +- .../include/zidl/session_listener_interface.h | 4 +- .../include/zidl/session_listener_proxy.h | 4 +- .../src/extension_session_manager.cpp | 8 +- .../src/scene_session_manager.cpp | 104 +++++++++--------- .../session_manager/src/session_manager.cpp | 6 +- .../src/zidl/scene_session_manager_proxy.cpp | 20 ++-- .../src/zidl/scene_session_manager_stub.cpp | 14 +-- .../src/zidl/session_listener_proxy.cpp | 4 +- window_scene/test/mock/mock_session.h | 2 +- window_scene/test/unittest/session_test.cpp | 8 +- wm/include/window_adapter.h | 2 +- wm/include/window_scene_session_impl.h | 2 +- wm/include/window_session_impl.h | 22 ++-- wm/src/window_adapter.cpp | 2 +- wm/src/window_extension_session_impl.cpp | 10 +- wm/src/window_scene_session_impl.cpp | 62 +++++------ wm/src/window_session_impl.cpp | 54 ++++----- .../include/zidl/window_manager_interface.h | 2 +- 48 files changed, 342 insertions(+), 341 deletions(-) diff --git a/window_scene/common/include/window_session_property.h b/window_scene/common/include/window_session_property.h index 0c7cdf4e6d..23e7863f61 100755 --- a/window_scene/common/include/window_session_property.h +++ b/window_scene/common/include/window_session_property.h @@ -69,8 +69,8 @@ public: void SetDisplayId(uint64_t displayId); void SetWindowType(WindowType type); void SetParentId(uint32_t parentId); - void SetPersistentId(uint64_t persistentId); - void SetParentPersistentId(uint64_t persistentId); + void SetPersistentId(uint32_t persistentId); + void SetParentPersistentId(uint32_t persistentId); void SetAccessTokenId(uint32_t accessTokenId); void SetTokenState(bool hasToken); void SetMaximizeMode(MaximizeMode mode); @@ -101,8 +101,8 @@ public: uint32_t GetParentId() const; uint32_t GetWindowFlags() const; uint64_t GetDisplayId() const; - uint64_t GetPersistentId() const; - uint64_t GetParentPersistentId() const; + uint32_t GetPersistentId() const; + uint32_t GetParentPersistentId() const; uint32_t GetAccessTokenId() const; bool GetTokenState() const; MaximizeMode GetMaximizeMode() const; @@ -140,8 +140,8 @@ private: uint64_t displayId_ = 0; uint32_t parentId_ = INVALID_SESSION_ID; // parentId of sceneSession, which is low 32 bite of parentPersistentId_ uint32_t flags_ = 0; - uint64_t persistentId_ = INVALID_SESSION_ID; - uint64_t parentPersistentId_ = INVALID_SESSION_ID; + uint32_t persistentId_ = INVALID_SESSION_ID; + uint32_t parentPersistentId_ = INVALID_SESSION_ID; uint32_t accessTokenId_ = INVALID_SESSION_ID; MaximizeMode maximizeMode_ = MaximizeMode::MODE_RECOVER; WindowMode windowMode_ = WindowMode::WINDOW_MODE_FULLSCREEN; diff --git a/window_scene/common/src/window_session_property.cpp b/window_scene/common/src/window_session_property.cpp index 23d8bace2d..b36f8259cf 100755 --- a/window_scene/common/src/window_session_property.cpp +++ b/window_scene/common/src/window_session_property.cpp @@ -170,22 +170,22 @@ uint32_t WindowSessionProperty::GetWindowFlags() const return flags_; } -void WindowSessionProperty::SetPersistentId(uint64_t persistentId) +void WindowSessionProperty::SetPersistentId(uint32_t persistentId) { persistentId_ = persistentId; } -uint64_t WindowSessionProperty::GetPersistentId() const +uint32_t WindowSessionProperty::GetPersistentId() const { return persistentId_; } -void WindowSessionProperty::SetParentPersistentId(uint64_t persistentId) +void WindowSessionProperty::SetParentPersistentId(uint32_t persistentId) { parentPersistentId_ = persistentId; } -uint64_t WindowSessionProperty::GetParentPersistentId() const +uint32_t WindowSessionProperty::GetParentPersistentId() const { return parentPersistentId_; } @@ -371,10 +371,10 @@ bool WindowSessionProperty::Marshalling(Parcel& parcel) const parcel.WriteBool(focusable_) && parcel.WriteBool(touchable_) && parcel.WriteBool(tokenState_) && parcel.WriteBool(turnScreenOn_) && parcel.WriteBool(keepScreenOn_) && parcel.WriteBool(isPrivacyMode_) && parcel.WriteBool(isSystemPrivacyMode_) && - parcel.WriteUint64(displayId_) && parcel.WriteUint64(persistentId_) && + parcel.WriteUint64(displayId_) && parcel.WriteUint32(persistentId_) && parcel.WriteString(sessionInfo_.bundleName_) && parcel.WriteString(sessionInfo_.moduleName_) && parcel.WriteString(sessionInfo_.abilityName_) && - parcel.WriteUint64(parentPersistentId_) && + parcel.WriteUint32(parentPersistentId_) && parcel.WriteUint32(accessTokenId_) && parcel.WriteUint32(static_cast(maximizeMode_)) && parcel.WriteFloat(brightness_) && parcel.WriteUint32(static_cast(requestedOrientation_)) && @@ -405,10 +405,10 @@ WindowSessionProperty* WindowSessionProperty::Unmarshalling(Parcel& parcel) property->SetPrivacyMode(parcel.ReadBool()); property->SetSystemPrivacyMode(parcel.ReadBool()); property->SetDisplayId(parcel.ReadUint64()); - property->SetPersistentId(parcel.ReadUint64()); + property->SetPersistentId(parcel.ReadUint32()); SessionInfo info = { parcel.ReadString(), parcel.ReadString(), parcel.ReadString() }; property->SetSessionInfo(info); - property->SetParentPersistentId(parcel.ReadUint64()); + property->SetParentPersistentId(parcel.ReadUint32()); property->SetAccessTokenId(parcel.ReadUint32()); property->SetMaximizeMode(static_cast(parcel.ReadUint32())); property->SetBrightness(parcel.ReadFloat()); diff --git a/window_scene/intention_event/dfx/include/dfx_hisysevent.h b/window_scene/intention_event/dfx/include/dfx_hisysevent.h index 8568182ad3..abaa462d13 100644 --- a/window_scene/intention_event/dfx/include/dfx_hisysevent.h +++ b/window_scene/intention_event/dfx/include/dfx_hisysevent.h @@ -22,7 +22,7 @@ namespace OHOS { namespace Rosen { class DfxHisysevent { public: - static void ApplicationBlockInput(int32_t eventId, int32_t pid, uint64_t persistentId); + static void ApplicationBlockInput(int32_t eventId, int32_t pid, uint32_t persistentId); }; } // namespace Rosen } // namespace OHOS diff --git a/window_scene/intention_event/dfx/src/dfx_hisysevent.cpp b/window_scene/intention_event/dfx/src/dfx_hisysevent.cpp index 7d1835d53a..2234bf4f4a 100644 --- a/window_scene/intention_event/dfx/src/dfx_hisysevent.cpp +++ b/window_scene/intention_event/dfx/src/dfx_hisysevent.cpp @@ -23,7 +23,7 @@ namespace { constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "DfxHisysevent" }; } // namespace -void DfxHisysevent::ApplicationBlockInput(int32_t eventId, int32_t pid, uint64_t persistentId) +void DfxHisysevent::ApplicationBlockInput(int32_t eventId, int32_t pid, uint32_t persistentId) { CALL_DEBUG_ENTER; int32_t ret = HiSysEventWrite( diff --git a/window_scene/intention_event/service/anr_manager/include/anr_manager.h b/window_scene/intention_event/service/anr_manager/include/anr_manager.h index e482cfac93..9737a6fa0c 100644 --- a/window_scene/intention_event/service/anr_manager/include/anr_manager.h +++ b/window_scene/intention_event/service/anr_manager/include/anr_manager.h @@ -34,20 +34,20 @@ class ANRManager final { public: DISALLOW_COPY_AND_MOVE(ANRManager); void Init(); - void AddTimer(int32_t id, int64_t currentTime, uint64_t persistentId); - void MarkProcessed(int32_t eventId, uint64_t persistentId); - bool IsANRTriggered(int64_t time, uint64_t persistentId); - void OnSessionLost(uint64_t persistentId); - void SetApplicationPid(uint64_t persistentId, int32_t applicationPid); + void AddTimer(int32_t id, int64_t currentTime, uint32_t persistentId); + void MarkProcessed(int32_t eventId, uint32_t persistentId); + bool IsANRTriggered(int64_t time, uint32_t persistentId); + void OnSessionLost(uint32_t persistentId); + void SetApplicationPid(uint32_t persistentId, int32_t applicationPid); void SetAnrObserver(std::function anrObserver); private: - int32_t GetPidByPersistentId(uint64_t persistentId); - void RemoveTimers(uint64_t persistentId); - void RemovePersistentId(uint64_t persistentId); + int32_t GetPidByPersistentId(uint32_t persistentId); + void RemoveTimers(uint32_t persistentId); + void RemovePersistentId(uint32_t persistentId); private: std::mutex mtx_; int32_t anrTimerCount_ { 0 }; - std::unordered_map applicationMap_; + std::unordered_map applicationMap_; std::function anrObserver_; EventStage eventStage_; }; diff --git a/window_scene/intention_event/service/anr_manager/src/anr_manager.cpp b/window_scene/intention_event/service/anr_manager/src/anr_manager.cpp index 7ed4ca1406..a9005c2fc8 100644 --- a/window_scene/intention_event/service/anr_manager/src/anr_manager.cpp +++ b/window_scene/intention_event/service/anr_manager/src/anr_manager.cpp @@ -39,7 +39,7 @@ void ANRManager::Init() TimerMgr->Init(); } -void ANRManager::AddTimer(int32_t id, int64_t currentTime, uint64_t persistentId) +void ANRManager::AddTimer(int32_t id, int64_t currentTime, uint32_t persistentId) { std::lock_guard guard(mtx_); if (anrTimerCount_ >= MAX_ANR_TIMER_COUNT) { @@ -47,11 +47,11 @@ void ANRManager::AddTimer(int32_t id, int64_t currentTime, uint64_t persistentId return; } int32_t timerId = TimerMgr->AddTimer(ANRTimeOutTime::INPUT_UI_TIMEOUT_TIME, [this, id, persistentId]() { - WLOGFD("Anr callback enter. persistentId:%{public}" PRIu64 ", eventId:%{public}d", persistentId, id); + WLOGFD("Anr callback enter. persistentId:%{public}" PRIu32 ", eventId:%{public}d", persistentId, id); eventStage_.SetAnrStatus(persistentId, true); int32_t pid = GetPidByPersistentId(persistentId); DfxHisysevent::ApplicationBlockInput(id, pid, persistentId); - WLOGFE("Application not responding. persistentId:%{public}" PRIu64 ", eventId:%{public}d, pid:%{public}d", + WLOGFE("Application not responding. persistentId:%{public}" PRIu32", eventId:%{public}d, pid:%{public}d", persistentId, id, pid); if (anrObserver_ != nullptr) { anrObserver_(pid); @@ -65,17 +65,17 @@ void ANRManager::AddTimer(int32_t id, int64_t currentTime, uint64_t persistentId anrTimerCount_--; } } - WLOGFD("Anr callback leave. persistentId:%{public}" PRIu64 ", eventId:%{public}d", persistentId, id); + WLOGFD("Anr callback leave. persistentId:%{public}" PRIu32 ", eventId:%{public}d", persistentId, id); }); anrTimerCount_++; eventStage_.SaveANREvent(persistentId, id, currentTime, timerId); } -void ANRManager::MarkProcessed(int32_t eventId, uint64_t persistentId) +void ANRManager::MarkProcessed(int32_t eventId, uint32_t persistentId) { CALL_DEBUG_ENTER; std::lock_guard guard(mtx_); - WLOGFD("eventId:%{public}d, persistentId:%{public}" PRIu64 "", eventId, persistentId); + WLOGFD("eventId:%{public}d, persistentId:%{public}" PRIu32"", eventId, persistentId); std::list timerIds = eventStage_.DelEvents(persistentId, eventId); for (int32_t item : timerIds) { if (item != -1) { @@ -85,17 +85,17 @@ void ANRManager::MarkProcessed(int32_t eventId, uint64_t persistentId) } } -bool ANRManager::IsANRTriggered(int64_t time, uint64_t persistentId) +bool ANRManager::IsANRTriggered(int64_t time, uint32_t persistentId) { std::lock_guard guard(mtx_); if (eventStage_.CheckAnrStatus(persistentId)) { - WLOGFD("Application not responding. persistentId:%{public}" PRIu64 "", persistentId); + WLOGFD("Application not responding. persistentId:%{public}" PRIu32 "", persistentId); return true; } return false; } -void ANRManager::OnSessionLost(uint64_t persistentId) +void ANRManager::OnSessionLost(uint32_t persistentId) { CALL_DEBUG_ENTER; std::lock_guard guard(mtx_); @@ -103,10 +103,10 @@ void ANRManager::OnSessionLost(uint64_t persistentId) RemovePersistentId(persistentId); } -void ANRManager::SetApplicationPid(uint64_t persistentId, int32_t applicationPid) +void ANRManager::SetApplicationPid(uint32_t persistentId, int32_t applicationPid) { std::lock_guard guard(mtx_); - WLOGFD("persistentId:%{public}" PRIu64 " -> applicationPid:%{public}d", persistentId, applicationPid); + WLOGFD("persistentId:%{public}" PRIu32 " -> applicationPid:%{public}d", persistentId, applicationPid); applicationMap_[persistentId] = applicationPid; } @@ -117,17 +117,17 @@ void ANRManager::SetAnrObserver(std::function anrObserver) anrObserver_ = anrObserver; } -int32_t ANRManager::GetPidByPersistentId(uint64_t persistentId) +int32_t ANRManager::GetPidByPersistentId(uint32_t persistentId) { if (applicationMap_.find(persistentId) != applicationMap_.end()) { - WLOGFD("persistentId:%{public}" PRIu64 " -> pid:%{public}d", persistentId, applicationMap_[persistentId]); + WLOGFD("persistentId:%{public}" PRIu32 " -> pid:%{public}d", persistentId, applicationMap_[persistentId]); return applicationMap_[persistentId]; } - WLOGFD("No application matches persistentId:%{public}" PRIu64 "", persistentId); + WLOGFD("No application matches persistentId:%{public}" PRIu32 "", persistentId); return -1; } -void ANRManager::RemoveTimers(uint64_t persistentId) +void ANRManager::RemoveTimers(uint32_t persistentId) { std::vector timerIds = eventStage_.GetTimerIds(persistentId); for (int32_t item : timerIds) { @@ -138,13 +138,13 @@ void ANRManager::RemoveTimers(uint64_t persistentId) } } -void ANRManager::RemovePersistentId(uint64_t persistentId) +void ANRManager::RemovePersistentId(uint32_t persistentId) { if (applicationMap_.find(persistentId) == applicationMap_.end()) { - WLOGFD("No persistentId:%{public}" PRIu64 " in applicationMap", persistentId); + WLOGFD("No persistentId:%{public}" PRIu32 " in applicationMap", persistentId); return; } - WLOGFD("Remove persistentId:%{public}" PRIu64 " -> applicationPid:%{public}d", + WLOGFD("Remove persistentId:%{public}" PRIu32 " -> applicationPid:%{public}d", persistentId, applicationMap_[persistentId]); applicationMap_.erase(persistentId); } diff --git a/window_scene/intention_event/service/event_stage/include/event_stage.h b/window_scene/intention_event/service/event_stage/include/event_stage.h index 385b6237ae..7c0b50d26e 100644 --- a/window_scene/intention_event/service/event_stage/include/event_stage.h +++ b/window_scene/intention_event/service/event_stage/include/event_stage.h @@ -23,19 +23,19 @@ namespace OHOS { namespace Rosen { class EventStage { public: - void SetAnrStatus(uint64_t persistentId, bool status); - bool CheckAnrStatus(uint64_t persistentId); - void SaveANREvent(uint64_t persistentId, int32_t id, int64_t time, int32_t timerId); - std::vector GetTimerIds(uint64_t persistentId); - std::list DelEvents(uint64_t persistentId, int32_t id); + void SetAnrStatus(uint32_t persistentId, bool status); + bool CheckAnrStatus(uint32_t persistentId); + void SaveANREvent(uint32_t persistentId, int32_t id, int64_t time, int32_t timerId); + std::vector GetTimerIds(uint32_t persistentId); + std::list DelEvents(uint32_t persistentId, int32_t id); private: struct EventTime { int32_t id { 0 }; int64_t eventTime { 0 }; int32_t timerId { -1 }; }; - std::map> events_; - std::map isAnrProcess_; + std::map> events_; + std::map isAnrProcess_; }; } // namespace Rosen } // namespace OHOS diff --git a/window_scene/intention_event/service/event_stage/src/event_stage.cpp b/window_scene/intention_event/service/event_stage/src/event_stage.cpp index 6fcb7138ce..a22e599493 100644 --- a/window_scene/intention_event/service/event_stage/src/event_stage.cpp +++ b/window_scene/intention_event/service/event_stage/src/event_stage.cpp @@ -29,30 +29,30 @@ namespace { constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "EventStage" }; } // namespace -void EventStage::SetAnrStatus(uint64_t persistentId, bool status) +void EventStage::SetAnrStatus(uint32_t persistentId, bool status) { isAnrProcess_[persistentId] = status; } -bool EventStage::CheckAnrStatus(uint64_t persistentId) +bool EventStage::CheckAnrStatus(uint32_t persistentId) { if (isAnrProcess_.find(persistentId) != isAnrProcess_.end()) { return isAnrProcess_[persistentId]; } - WLOGFD("Current persistentId:%{public}" PRIu64 " is not in event stage", persistentId); + WLOGFD("Current persistentId:%{public}" PRIu32 " is not in event stage", persistentId); return false; } -void EventStage::SaveANREvent(uint64_t persistentId, int32_t id, int64_t time, int32_t timerId) +void EventStage::SaveANREvent(uint32_t persistentId, int32_t id, int64_t time, int32_t timerId) { EventTime eventTime { id, time, timerId }; events_[persistentId].push_back(eventTime); } -std::vector EventStage::GetTimerIds(uint64_t persistentId) +std::vector EventStage::GetTimerIds(uint32_t persistentId) { if (events_.find(persistentId) == events_.end()) { - WLOGFD("Current events have no event for persistentId:%{public}" PRIu64 "", persistentId); + WLOGFD("Current events have no event for persistentId:%{public}" PRIu32 "", persistentId); return {}; } std::vector timers; @@ -63,11 +63,11 @@ std::vector EventStage::GetTimerIds(uint64_t persistentId) return timers; } -std::list EventStage::DelEvents(uint64_t persistentId, int32_t id) +std::list EventStage::DelEvents(uint32_t persistentId, int32_t id) { - WLOGFD("Delete events, persistentId:%{public}" PRIu64 ", id:%{public}d", persistentId, id); + WLOGFD("Delete events, persistentId:%{public}" PRIu32 ", id:%{public}d", persistentId, id); if (events_.find(persistentId) == events_.end()) { - WLOGFD("Current events have no event persistentId:%{public}" PRIu64 "", persistentId); + WLOGFD("Current events have no event persistentId:%{public}" PRIu32 "", persistentId); return {}; } auto &events = events_[persistentId]; diff --git a/window_scene/intention_event/src/intention_event_manager.cpp b/window_scene/intention_event/src/intention_event_manager.cpp index d346591b89..1e1c9a0e08 100644 --- a/window_scene/intention_event/src/intention_event_manager.cpp +++ b/window_scene/intention_event/src/intention_event_manager.cpp @@ -69,7 +69,7 @@ void IntentionEventManager::InputEventListener::OnInputEvent( void IntentionEventManager::InputEventListener::OnInputEvent( std::shared_ptr keyEvent) const { - uint64_t focusedSessionId = SceneSessionManager::GetInstance().GetFocusedSession(); + auto focusedSessionId = SceneSessionManager::GetInstance().GetFocusedSession(); if (focusedSessionId == INVALID_SESSION_ID) { WLOGFE("focusedSessionId is invalid"); return; diff --git a/window_scene/interfaces/include/ws_common.h b/window_scene/interfaces/include/ws_common.h index 16d8fffa86..cc77972924 100644 --- a/window_scene/interfaces/include/ws_common.h +++ b/window_scene/interfaces/include/ws_common.h @@ -28,7 +28,7 @@ class AbilityStartSetting; } namespace OHOS::Rosen { -constexpr uint64_t INVALID_SESSION_ID = 0; +constexpr uint32_t INVALID_SESSION_ID = 0; enum class WSError : int32_t { WS_OK = 0, @@ -110,8 +110,8 @@ struct SessionInfo { int32_t requestCode; int32_t errorCode; std::string errorReason; - uint64_t persistentId_ = INVALID_SESSION_ID; - uint64_t callerPersistentId_ = INVALID_SESSION_ID; + uint32_t persistentId_ = INVALID_SESSION_ID; + uint32_t callerPersistentId_ = INVALID_SESSION_ID; uint32_t callState_ = 0; int64_t uiAbilityId_ = 0; }; diff --git a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.cpp b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.cpp index 4b2772d5fe..ab7952c13c 100644 --- a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.cpp +++ b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session.cpp @@ -58,8 +58,8 @@ NativeValue* JsSceneSession::Create(NativeEngine& engine, const sptr jsSceneSession = std::make_unique(engine, session); object->SetNativePointer(jsSceneSession.release(), JsSceneSession::Finalizer, nullptr); - object->SetProperty("persistentId", CreateJsValue(engine, static_cast(session->GetPersistentId()))); - object->SetProperty("parentId", CreateJsValue(engine, static_cast(session->GetParentPersistentId()))); + object->SetProperty("persistentId", CreateJsValue(engine, static_cast(session->GetPersistentId()))); + object->SetProperty("parentId", CreateJsValue(engine, static_cast(session->GetParentPersistentId()))); object->SetProperty("type", CreateJsValue(engine, static_cast(GetApiType(session->GetWindowType())))); const char* moduleName = "JsSceneSession"; BindNativeFunction(engine, *object, "on", moduleName, JsSceneSession::RegisterCallback); diff --git a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp index 6fd46733f0..bee72ee888 100644 --- a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp +++ b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_session_manager.cpp @@ -381,7 +381,7 @@ NativeValue* JsSceneSessionManager::OnUpdateFocus(NativeEngine& engine, NativeCa "Input parameter is missing or invalid")); return engine.CreateUndefined(); } - int64_t persistentId; + uint32_t persistentId; if (!ConvertFromJsValue(engine, info.argv[0], persistentId)) { WLOGFE("[NAPI]Failed to convert parameter to persistentId"); engine.Throw(CreateJsError(engine, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), @@ -395,7 +395,7 @@ NativeValue* JsSceneSessionManager::OnUpdateFocus(NativeEngine& engine, NativeCa "Input parameter is missing or invalid")); return engine.CreateUndefined(); } - SceneSessionManager::GetInstance().UpdateFocus(static_cast(persistentId), isFocused); + SceneSessionManager::GetInstance().UpdateFocus(persistentId, isFocused); return engine.CreateUndefined(); } @@ -745,14 +745,14 @@ NativeValue* JsSceneSessionManager::OnGetSessionSnapshot(NativeEngine& engine, N "Input parameter is missing or invalid")); return engine.CreateUndefined(); } - int64_t persistentId; + uint32_t persistentId; if (!ConvertFromJsValue(engine, info.argv[0], persistentId)) { WLOGFE("[NAPI]Failed to convert parameter to persistentId"); engine.Throw(CreateJsError(engine, static_cast(WSErrorCode::WS_ERROR_INVALID_PARAM), "Input parameter is missing or invalid")); return engine.CreateUndefined(); } - std::string path = SceneSessionManager::GetInstance().GetSessionSnapshot(static_cast(persistentId)); + std::string path = SceneSessionManager::GetInstance().GetSessionSnapshot(persistentId); NativeValue* result = engine.CreateString(path.c_str(), path.length()); return result; } diff --git a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_utils.cpp b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_utils.cpp index d2062cb62a..d0915d1392 100644 --- a/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_utils.cpp +++ b/window_scene/interfaces/kits/napi/scene_session_manager/js_scene_utils.cpp @@ -69,7 +69,7 @@ bool ConvertSessionInfoFromJs(NativeEngine& engine, NativeObject* jsObject, Sess sessionInfo.isSystem_ = isSystem; } if (jsPersistentId->TypeOf() != NATIVE_UNDEFINED) { - int64_t persistentId; + uint32_t persistentId; if (!ConvertFromJsValue(engine, jsPersistentId, persistentId)) { WLOGFE("[NAPI]Failed to convert parameter to persistentId"); return false; @@ -110,9 +110,9 @@ NativeValue* CreateJsSessionInfo(NativeEngine& engine, const SessionInfo& sessio object->SetProperty("moduleName", CreateJsValue(engine, sessionInfo.moduleName_)); object->SetProperty("abilityName", CreateJsValue(engine, sessionInfo.abilityName_)); object->SetProperty("isSystem", CreateJsValue(engine, sessionInfo.isSystem_)); - object->SetProperty("persistentId", CreateJsValue(engine, static_cast(sessionInfo.persistentId_))); + object->SetProperty("persistentId", CreateJsValue(engine, static_cast(sessionInfo.persistentId_))); object->SetProperty("callerPersistentId", CreateJsValue(engine, - static_cast(sessionInfo.callerPersistentId_))); + static_cast(sessionInfo.callerPersistentId_))); object->SetProperty("callState", CreateJsValue(engine, static_cast(sessionInfo.callState_))); return objValue; } diff --git a/window_scene/session/host/include/move_drag_controller.h b/window_scene/session/host/include/move_drag_controller.h index 773b71d48f..209db234f3 100644 --- a/window_scene/session/host/include/move_drag_controller.h +++ b/window_scene/session/host/include/move_drag_controller.h @@ -56,7 +56,7 @@ public: } }; - MoveDragController(uint64_t persistentId); + MoveDragController(uint32_t persistentId); ~MoveDragController(); void SetVsyncHandleListenser(const NotifyVsyncHandleFunc& func); @@ -112,7 +112,7 @@ private: MoveDragProperty moveDragProperty_ = { -1, -1, -1, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } }; std::shared_ptr vsyncCallback_ = std::make_shared(VsyncCallback()); NotifyVsyncHandleFunc vsyncHandleFunc_; - uint64_t persistentId_; + uint32_t persistentId_; enum class DragType : uint32_t { DRAG_UNDEFINED, diff --git a/window_scene/session/host/include/scene_persistence.h b/window_scene/session/host/include/scene_persistence.h index 124fda6206..b4c818d94a 100644 --- a/window_scene/session/host/include/scene_persistence.h +++ b/window_scene/session/host/include/scene_persistence.h @@ -33,10 +33,10 @@ namespace OHOS::Rosen { class ScenePersistence : public RefBase { public: ScenePersistence() = default; - ScenePersistence(const SessionInfo &info, const uint64_t persistentId); + ScenePersistence(const SessionInfo& info, const uint32_t& persistentId); ~ScenePersistence() = default; - static inline bool CreateSnapshotDir(std::string strFilesDir) + static inline bool CreateSnapshotDir(const std::string& strFilesDir) { strPersistPath_ = strFilesDir + "/SceneSnapShot/"; constexpr mode_t MKDIR_MODE = 0740; @@ -48,8 +48,8 @@ public: bool IsSnapshotExisted() const; std::string GetSnapshotFilePath() const; - void SetPersistentId(const uint64_t persistId); - void SaveSnapshot(const std::shared_ptr &pixelMap); + void SetPersistentId(const uint32_t& persistId); + void SaveSnapshot(const std::shared_ptr& pixelMap); private: static std::string strPersistPath_; diff --git a/window_scene/session/host/include/scene_session.h b/window_scene/session/host/include/scene_session.h index 2cd97c1ee7..2b67d1a64f 100644 --- a/window_scene/session/host/include/scene_session.h +++ b/window_scene/session/host/include/scene_session.h @@ -27,10 +27,10 @@ namespace OHOS::Rosen { class SceneSession; using SpecificSessionCreateCallback = std::function(const SessionInfo& info, sptr property)>; -using SpecificSessionDestroyCallback = std::function; +using SpecificSessionDestroyCallback = std::function; using CameraFloatSessionChangeCallback = std::function; using GetSceneSessionVectorByTypeCallback = std::function>(WindowType type)>; -using UpdateAvoidAreaCallback = std::function; +using UpdateAvoidAreaCallback = std::function; using NotifyCreateSpecificSessionFunc = std::function& session)>; using NotifySessionRectChangeFunc = std::function; @@ -89,8 +89,8 @@ public: WSError UpdateSessionRect(const WSRect& rect, const SizeChangeReason& reason) override; WSError CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) override; - WSError DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) override; + sptr property, uint32_t& persistentId, sptr& session) override; + WSError DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) override; WSError SetSystemBarProperty(WindowType type, SystemBarProperty systemBarProperty); WSError OnNeedAvoid(bool status) override; void CalculateAvoidAreaRect(WSRect& rect, WSRect& avoidRect, AvoidArea& avoidArea); diff --git a/window_scene/session/host/include/session.h b/window_scene/session/host/include/session.h index 445c94e656..a306bac0f8 100644 --- a/window_scene/session/host/include/session.h +++ b/window_scene/session/host/include/session.h @@ -43,7 +43,7 @@ namespace OHOS::Rosen { class RSSurfaceNode; using NotifyPendingSessionActivationFunc = std::function; using NotifySessionStateChangeFunc = std::function; -using NotifySessionStateChangeNotifyManagerFunc = std::function; +using NotifySessionStateChangeNotifyManagerFunc = std::function; using NotifyBackPressedFunc = std::function; using NotifySessionFocusableChangeFunc = std::function; using NotifySessionTouchableChangeFunc = std::function; @@ -53,7 +53,7 @@ using NotifyTerminateSessionFuncNew = std::function; using NotifyPendingSessionToForegroundFunc = std::function; using NotifyPendingSessionToBackgroundForDelegatorFunc = std::function; -using NotifyCallingSessionForegroundFunc = std::function; +using NotifyCallingSessionForegroundFunc = std::function; using NotifyCallingSessionBackgroundFunc = std::function; class ILifecycleListener { @@ -69,8 +69,8 @@ public: explicit Session(const SessionInfo& info) : sessionInfo_(info) {} virtual ~Session() = default; - uint64_t GetPersistentId() const; - uint64_t GetParentPersistentId() const; + uint32_t GetPersistentId() const; + uint32_t GetParentPersistentId() const; void SetSessionRect(const WSRect& rect); std::shared_ptr GetSurfaceNode() const; @@ -137,8 +137,8 @@ public: WSError UpdateSessionRect(const WSRect& rect, const SizeChangeReason& reason) override; WSError CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) override; - WSError DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) override; + sptr property, uint32_t& persistentId, sptr& session) override; + WSError DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) override; void SetSystemConfig(const SystemSessionConfig& systemConfig); void SetBackPressedListenser(const NotifyBackPressedFunc& func); WSError ProcessBackEvent(); // send back event to session_stage @@ -256,7 +256,7 @@ private: std::shared_ptr CreateSurfaceNode(const std::string& name); std::shared_ptr Snapshot(); - uint64_t persistentId_ = INVALID_SESSION_ID; + uint32_t persistentId_ = INVALID_SESSION_ID; static std::atomic sessionId_; static std::set persistIdSet_; std::shared_ptr surfaceNode_ = nullptr; diff --git a/window_scene/session/host/include/zidl/session_interface.h b/window_scene/session/host/include/zidl/session_interface.h index c7fe76bca8..6d8ece7ba8 100644 --- a/window_scene/session/host/include/zidl/session_interface.h +++ b/window_scene/session/host/include/zidl/session_interface.h @@ -82,8 +82,8 @@ public: virtual WSError UpdateSessionRect(const WSRect& rect, const SizeChangeReason& reason) = 0; virtual WSError CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) = 0; - virtual WSError DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) = 0; + sptr property, uint32_t& persistentId, sptr& session) = 0; + virtual WSError DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) = 0; virtual WSError OnNeedAvoid(bool status) = 0; virtual AvoidArea GetAvoidAreaByType(AvoidAreaType type) = 0; virtual WSError RequestSessionBack() = 0; diff --git a/window_scene/session/host/include/zidl/session_proxy.h b/window_scene/session/host/include/zidl/session_proxy.h index 0253f5a2cb..639b506306 100644 --- a/window_scene/session/host/include/zidl/session_proxy.h +++ b/window_scene/session/host/include/zidl/session_proxy.h @@ -41,8 +41,8 @@ public: WSError UpdateSessionRect(const WSRect& rect, const SizeChangeReason& reason) override; WSError CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) override; - WSError DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) override; + sptr property, uint32_t& persistentId, sptr& session) override; + WSError DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) override; WSError OnNeedAvoid(bool status) override; AvoidArea GetAvoidAreaByType(AvoidAreaType type) override; WSError RequestSessionBack() override; diff --git a/window_scene/session/host/src/move_drag_controller.cpp b/window_scene/session/host/src/move_drag_controller.cpp index 1c62c0112e..2ae45107df 100644 --- a/window_scene/session/host/src/move_drag_controller.cpp +++ b/window_scene/session/host/src/move_drag_controller.cpp @@ -31,7 +31,7 @@ namespace { constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "MoveDragController" }; } -MoveDragController::MoveDragController(uint64_t persistentId) : persistentId_(persistentId) +MoveDragController::MoveDragController(uint32_t persistentId) : persistentId_(persistentId) { vsyncCallback_->onCallback = std::bind(&MoveDragController::OnReceiveVsync, this, std::placeholders::_1); } @@ -617,7 +617,7 @@ void MoveDragController::HandleMouseStyle(const std::shared_ptr &pixelMap) +void ScenePersistence::SaveSnapshot(const std::shared_ptr& pixelMap) { if (pixelMap == nullptr || strSnapshotFile_.find('/') == std::string::npos) { return; diff --git a/window_scene/session/host/src/scene_session.cpp b/window_scene/session/host/src/scene_session.cpp index 5b12a90df0..70127b3e44 100644 --- a/window_scene/session/host/src/scene_session.cpp +++ b/window_scene/session/host/src/scene_session.cpp @@ -217,9 +217,9 @@ WSError SceneSession::RaiseToAppTop() WSError SceneSession::CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) + sptr property, uint32_t& persistentId, sptr& session) { - WLOGFI("CreateAndConnectSpecificSession id: %{public}" PRIu64 "", GetPersistentId()); + WLOGFI("CreateAndConnectSpecificSession id: %{public}" PRIu32 "", GetPersistentId()); sptr sceneSession; if (specificCallback_ != nullptr) { sceneSession = specificCallback_->onCreate_(sessionInfo_, property); @@ -241,7 +241,7 @@ WSError SceneSession::CreateAndConnectSpecificSession(const sptr& return errCode; } -WSError SceneSession::DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) +WSError SceneSession::DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) { WSError ret = WSError::WS_OK; if (specificCallback_ != nullptr) { @@ -570,7 +570,7 @@ bool SceneSession::IsKeepScreenOn() const std::string SceneSession::GetSessionSnapshot() { - WLOGFI("GetSessionSnapshot id %{public}" PRIu64 "", GetPersistentId()); + WLOGFI("GetSessionSnapshot id %{public}" PRIu32 "", GetPersistentId()); if (Session::GetSessionState() < SessionState::STATE_BACKGROUND) { Session::UpdateSnapshot(); } @@ -594,7 +594,7 @@ WSError SceneSession::UpdateWindowAnimationFlag(bool needDefaultAnimationFlag) void SceneSession::NotifyIsCustomAnimatiomPlaying(bool isPlaying) { - WLOGFI("id %{public}" PRIu64 " %{public}u", GetPersistentId(), isPlaying); + WLOGFI("id %{public}" PRIu32 " %{public}u", GetPersistentId(), isPlaying); for (auto& sessionChangeCallback : sessionChangeCallbackList_) { if (sessionChangeCallback != nullptr && sessionChangeCallback->onIsCustomAnimationPlaying_) { sessionChangeCallback->onIsCustomAnimationPlaying_(isPlaying); @@ -604,15 +604,15 @@ void SceneSession::NotifyIsCustomAnimatiomPlaying(bool isPlaying) WSError SceneSession::UpdateWindowSceneAfterCustomAnimation(bool isAdd) { - WLOGFI("id %{public}" PRIu64 "", GetPersistentId()); + WLOGFI("id %{public}" PRIu32 "", GetPersistentId()); if (isAdd) { if (!setWindowScenePatternFunc_ || !setWindowScenePatternFunc_->setOpacityFunc_) { - WLOGFE("SetOpacityFunc not register %{public}" PRIu64 "", GetPersistentId()); + WLOGFE("SetOpacityFunc not register %{public}" PRIu32 "", GetPersistentId()); return WSError::WS_ERROR_INVALID_OPERATION; } setWindowScenePatternFunc_->setOpacityFunc_(1.0f); } else { - WLOGFI("background after custom animation id %{public}" PRIu64 "", GetPersistentId()); + WLOGFI("background after custom animation id %{public}" PRIu32 "", GetPersistentId()); // since background will remove surfaceNode Background(); NotifyIsCustomAnimatiomPlaying(false); diff --git a/window_scene/session/host/src/session.cpp b/window_scene/session/host/src/session.cpp index fb5416b6d7..1b41cf0184 100644 --- a/window_scene/session/host/src/session.cpp +++ b/window_scene/session/host/src/session.cpp @@ -39,12 +39,12 @@ constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "Sessio std::atomic Session::sessionId_(INVALID_SESSION_ID); std::set Session::persistIdSet_; -uint64_t Session::GetPersistentId() const +uint32_t Session::GetPersistentId() const { return persistentId_; } -uint64_t Session::GetParentPersistentId() const +uint32_t Session::GetParentPersistentId() const { if (property_ != nullptr) { return property_->GetParentPersistentId(); @@ -297,7 +297,7 @@ bool Session::IsSessionValid() const { bool res = state_ > SessionState::STATE_DISCONNECT && state_ < SessionState::STATE_END; if (!res) { - WLOGFI("session is already destroyed or not created! id: %{public}" PRIu64 " state: %{public}u", + WLOGFI("session is already destroyed or not created! id: %{public}" PRIu32 " state: %{public}u", GetPersistentId(), state_); } return res; @@ -305,7 +305,7 @@ bool Session::IsSessionValid() const WSError Session::UpdateRect(const WSRect& rect, SizeChangeReason reason) { - WLOGFI("session update rect: id: %{public}" PRIu64 ", rect[%{public}d, %{public}d, %{public}u, %{public}u], "\ + WLOGFI("session update rect: id: %{public}" PRIu32 ", rect[%{public}d, %{public}d, %{public}u, %{public}u], "\ "reason:%{public}u", GetPersistentId(), rect.posX_, rect.posY_, rect.width_, rect.height_, reason); if (!IsSessionValid()) { winRect_ = rect; @@ -327,7 +327,7 @@ WSError Session::Connect(const sptr& sessionStage, const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, SystemSessionConfig& systemConfig, sptr property, sptr token) { - WLOGFI("Connect session, id: %{public}" PRIu64 ", state: %{public}u", GetPersistentId(), + WLOGFI("Connect session, id: %{public}" PRIu32 ", state: %{public}u", GetPersistentId(), static_cast(GetSessionState())); if (GetSessionState() != SessionState::STATE_DISCONNECT) { WLOGFE("state is not disconnect!"); @@ -365,7 +365,7 @@ WSError Session::UpdateWindowSessionProperty(sptr propert WSError Session::Foreground(sptr property) { SessionState state = GetSessionState(); - WLOGFI("Foreground session, id: %{public}" PRIu64 ", state: %{public}u", GetPersistentId(), + WLOGFI("Foreground session, id: %{public}" PRIu32 ", state: %{public}" PRIu32"", GetPersistentId(), static_cast(state)); if (state != SessionState::STATE_CONNECT && state != SessionState::STATE_BACKGROUND) { WLOGFE("state invalid!"); @@ -395,7 +395,7 @@ void Session::NotifyCallingSessionForeground() WSError Session::Background() { SessionState state = GetSessionState(); - WLOGFI("Background session, id: %{public}" PRIu64 ", state: %{public}u", GetPersistentId(), + WLOGFI("Background session, id: %{public}" PRIu32 ", state: %{public}" PRIu32"", GetPersistentId(), static_cast(state)); if (state < SessionState::STATE_INACTIVE) { // only STATE_INACTIVE can transfer to background WLOGFE("state invalid!"); @@ -421,7 +421,7 @@ void Session::NotifyCallingSessionBackground() WSError Session::Disconnect() { SessionState state = GetSessionState(); - WLOGFI("Disconnect session, id: %{public}" PRIu64 ", state: %{public}u", GetPersistentId(), + WLOGFI("Disconnect session, id: %{public}" PRIu32 ", state: %{public}" PRIu32"", GetPersistentId(), static_cast(state)); state_ = SessionState::STATE_INACTIVE; NotifyDisconnect(); @@ -436,8 +436,8 @@ WSError Session::Disconnect() WSError Session::SetActive(bool active) { SessionState state = GetSessionState(); - WLOGFI("Session update active: %{public}d, id: %{public}" PRIu64 ", state: %{public}u", active, GetPersistentId(), - static_cast(state)); + WLOGFI("Session update active: %{public}d, id: %{public}" PRIu32 ", state: %{public}" PRIu32"", + active, GetPersistentId(), static_cast(state)); if (!IsSessionValid()) { return WSError::WS_ERROR_INVALID_SESSION; } @@ -478,7 +478,7 @@ WSError Session::PendingSessionActivation(const sptr ability info.startSetting = abilitySessionInfo->startSetting; WLOGFI("PendingSessionActivation:bundleName %{public}s, moduleName:%{public}s, abilityName:%{public}s", info.bundleName_.c_str(), info.moduleName_.c_str(), info.abilityName_.c_str()); - WLOGFI("PendingSessionActivation callState:%{public}d, want persistentId: %{public}" PRIu64 ", \ + WLOGFI("PendingSessionActivation callState:%{public}d, want persistentId: %{public}" PRIu32 ", \ uiAbilityId: %{public}" PRIu64 "", info.callState_, info.persistentId_, info.uiAbilityId_); if (pendingSessionActivationFunc_) { pendingSessionActivationFunc_(info); @@ -506,7 +506,7 @@ WSError Session::TerminateSession(const sptr abilitySessionI info.abilityName_ = abilitySessionInfo->want.GetElement().GetAbilityName(); info.bundleName_ = abilitySessionInfo->want.GetElement().GetBundleName(); info.callerToken_ = abilitySessionInfo->callerToken; - info.persistentId_ = abilitySessionInfo->persistentId; + info.persistentId_ = static_cast(abilitySessionInfo->persistentId); sessionInfo_.want = new AAFwk::Want(abilitySessionInfo->want); sessionInfo_.resultCode = abilitySessionInfo->resultCode; if (terminateSessionFunc_) { @@ -530,7 +530,7 @@ WSError Session::TerminateSessionNew(const sptr abilitySessi info.abilityName_ = abilitySessionInfo->want.GetElement().GetAbilityName(); info.bundleName_ = abilitySessionInfo->want.GetElement().GetBundleName(); info.callerToken_ = abilitySessionInfo->callerToken; - info.persistentId_ = abilitySessionInfo->persistentId; + info.persistentId_ = static_cast(abilitySessionInfo->persistentId); sessionInfo_.want = new AAFwk::Want(abilitySessionInfo->want); sessionInfo_.resultCode = abilitySessionInfo->resultCode; if (terminateSessionFuncNew_) { @@ -556,7 +556,7 @@ WSError Session::NotifySessionException(const sptr abilitySe info.callerToken_ = abilitySessionInfo->callerToken; info.errorCode = abilitySessionInfo->errorCode; info.errorReason = abilitySessionInfo->errorReason; - info.persistentId_ = abilitySessionInfo->persistentId; + info.persistentId_ = static_cast(abilitySessionInfo->persistentId); sessionInfo_.want = new AAFwk::Want(abilitySessionInfo->want); sessionInfo_.errorCode = abilitySessionInfo->errorCode; sessionInfo_.errorReason = abilitySessionInfo->errorReason; @@ -586,7 +586,8 @@ WSError Session::PendingSessionToForeground() return WSError::WS_OK; } -void Session::SetPendingSessionToBackgroundForDelegatorListener(const NotifyPendingSessionToBackgroundForDelegatorFunc& func) +void Session::SetPendingSessionToBackgroundForDelegatorListener( + const NotifyPendingSessionToBackgroundForDelegatorFunc& func) { pendingSessionToBackgroundForDelegatorFunc_ = func; } @@ -678,7 +679,7 @@ WSError Session::TransferPointerEvent(const std::shared_ptr& return WSError::WS_ERROR_INVALID_PERMISSION; } } - WLOGFD("Session TransferPointEvent, Id: %{public}" PRIu64 ", eventId: %{public}d", + WLOGFD("Session TransferPointEvent, Id: %{public}" PRIu32 ", eventId: %{public}d", persistentId_, pointerEvent->GetId()); auto currentTime = GetSysClockTime(); if (DelayedSingleton::GetInstance()->IsANRTriggered(currentTime, persistentId_)) { @@ -714,7 +715,7 @@ WSError Session::TransferKeyEvent(const std::shared_ptr& keyEvent return WSError::WS_ERROR_INVALID_PERMISSION; } } - WLOGFD("Session TransferKeyEvent, Id: %{public}" PRIu64 ", eventId: %{public}d", + WLOGFD("Session TransferKeyEvent, Id: %{public}" PRIu32 ", eventId: %{public}d", persistentId_, keyEvent->GetId()); auto currentTime = GetSysClockTime(); if (DelayedSingleton::GetInstance()->IsANRTriggered(currentTime, persistentId_)) { @@ -725,7 +726,7 @@ WSError Session::TransferKeyEvent(const std::shared_ptr& keyEvent WLOGFE("windowEventChannel_ is null"); return WSError::WS_ERROR_NULLPTR; } - WLOGD("TransferKeyEvent, id: %{public}" PRIu64, persistentId_); + WLOGD("TransferKeyEvent, id: %{public}" PRIu32, persistentId_); if (WSError ret = windowEventChannel_->TransferKeyEvent(keyEvent); ret != WSError::WS_OK) { WLOGFE("TransferKeyEvent failed"); return ret; @@ -858,7 +859,7 @@ void Session::NotifyClick() WSError Session::UpdateFocus(bool isFocused) { - WLOGFI("Session update focus id: %{public}" PRIu64, GetPersistentId()); + WLOGFI("Session update focus id: %{public}" PRIu32, GetPersistentId()); if (isFocused_ == isFocused) { WLOGFD("Session focus do not change: [%{public}d]", isFocused); return WSError::WS_DO_NOTHING; @@ -932,12 +933,12 @@ WSError Session::RaiseToAppTop() WSError Session::CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) + sptr property, uint32_t& persistentId, sptr& session) { return WSError::WS_OK; } -WSError Session::DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) +WSError Session::DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) { return WSError::WS_OK; } @@ -980,8 +981,8 @@ WSError Session::ProcessBackEvent() WSError Session::MarkProcessed(int32_t eventId) { - uint64_t persistentId = GetPersistentId(); - WLOGFI("persistentId:%{public}" PRIu64 ", eventId:%{public}d", persistentId, eventId); + uint32_t persistentId = GetPersistentId(); + WLOGFI("persistentId:%{public}" PRIu32 ", eventId:%{public}d", persistentId, eventId); DelayedSingleton::GetInstance()->MarkProcessed(eventId, persistentId); return WSError::WS_OK; } @@ -990,7 +991,7 @@ void Session::GeneratePersistentId(bool isExtension, const SessionInfo& sessionI { if (sessionInfo.persistentId_ != INVALID_SESSION_ID) { persistIdSet_.insert(sessionInfo.persistentId_); - persistentId_ = static_cast(sessionInfo.persistentId_); + persistentId_ = static_cast(sessionInfo.persistentId_); return; } diff --git a/window_scene/session/host/src/zidl/session_proxy.cpp b/window_scene/session/host/src/zidl/session_proxy.cpp index 0e18a66873..f752641f94 100644 --- a/window_scene/session/host/src/zidl/session_proxy.cpp +++ b/window_scene/session/host/src/zidl/session_proxy.cpp @@ -146,7 +146,7 @@ WSError SessionProxy::Connect(const sptr& sessionStage, const spt sptr config = reply.ReadParcelable(); systemConfig = *config; if (property) { - property->SetPersistentId(reply.ReadUint64()); + property->SetPersistentId(reply.ReadUint32()); } int32_t ret = reply.ReadInt32(); return static_cast(ret); @@ -187,7 +187,7 @@ WSError SessionProxy::PendingSessionActivation(sptr abilityS WLOGFE("Write requestCode info failed"); return WSError::WS_ERROR_IPC_FAILED; } - if (!(data.WriteInt64(abilitySessionInfo->persistentId))) { + if (!(data.WriteInt32(static_cast(abilitySessionInfo->persistentId)))) { WLOGFE("Write persistentId failed"); return WSError::WS_ERROR_IPC_FAILED; } @@ -384,7 +384,7 @@ WSError SessionProxy::UpdateSessionRect(const WSRect& rect, const SizeChangeReas WSError SessionProxy::CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) + sptr property, uint32_t& persistentId, sptr& session) { MessageParcel data; MessageParcel reply; @@ -423,7 +423,7 @@ WSError SessionProxy::CreateAndConnectSpecificSession(const sptr& WLOGFE("SendRequest failed"); return WSError::WS_ERROR_IPC_FAILED; } - persistentId = reply.ReadUint64(); + persistentId = reply.ReadUint32(); sptr sessionObject = reply.ReadRemoteObject(); if (sessionObject == nullptr) { WLOGFE("ReadRemoteObject failed"); @@ -434,7 +434,7 @@ WSError SessionProxy::CreateAndConnectSpecificSession(const sptr& return static_cast(ret); } -WSError SessionProxy::DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) +WSError SessionProxy::DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) { MessageParcel data; MessageParcel reply; @@ -443,8 +443,8 @@ WSError SessionProxy::DestroyAndDisconnectSpecificSession(const uint64_t& persis WLOGFE("WriteInterfaceToken failed"); return WSError::WS_ERROR_IPC_FAILED; } - if (!data.WriteUint64(persistentId)) { - WLOGFE("Write uint64_t failed"); + if (!data.WriteUint32(persistentId)) { + WLOGFE("Write persistentId failed"); } if (Remote()->SendRequest(static_cast( SessionMessage::TRANS_ID_DESTROY_AND_DISCONNECT_SPECIFIC_SESSION), diff --git a/window_scene/session/host/src/zidl/session_stub.cpp b/window_scene/session/host/src/zidl/session_stub.cpp index 403e5813a7..70e34744cc 100644 --- a/window_scene/session/host/src/zidl/session_stub.cpp +++ b/window_scene/session/host/src/zidl/session_stub.cpp @@ -164,7 +164,7 @@ int SessionStub::HandleConnect(MessageParcel& data, MessageParcel& reply) WSError errCode = Connect(sessionStage, eventChannel, surfaceNode, systemConfig, property, token); reply.WriteParcelable(&systemConfig); if (property) { - reply.WriteUint64(property->GetPersistentId()); + reply.WriteUint32(property->GetPersistentId()); } reply.WriteUint32(static_cast(errCode)); return ERR_NONE; @@ -221,7 +221,7 @@ int SessionStub::HandlePendingSessionActivation(MessageParcel& data, MessageParc abilitySessionInfo->callerToken = data.ReadRemoteObject(); } abilitySessionInfo->requestCode = data.ReadInt32(); - abilitySessionInfo->persistentId = data.ReadUint64(); + abilitySessionInfo->persistentId = data.ReadUint32(); abilitySessionInfo->state = static_cast(data.ReadInt32()); abilitySessionInfo->uiAbilityId = data.ReadInt64(); if (data.ReadBool()) { @@ -276,14 +276,14 @@ int SessionStub::HandleCreateAndConnectSpecificSession(MessageParcel& data, Mess } else { WLOGFW("Property not exist!"); } - uint64_t persistentId = INVALID_SESSION_ID; + auto persistentId = INVALID_SESSION_ID; sptr sceneSession; CreateAndConnectSpecificSession(sessionStage, eventChannel, surfaceNode, property, persistentId, sceneSession); if (sceneSession== nullptr) { return ERR_INVALID_STATE; } - reply.WriteUint64(persistentId); + reply.WriteUint32(persistentId); reply.WriteRemoteObject(sceneSession->AsObject()); reply.WriteUint32(static_cast(WSError::WS_OK)); return ERR_NONE; @@ -291,7 +291,7 @@ int SessionStub::HandleCreateAndConnectSpecificSession(MessageParcel& data, Mess int SessionStub::HandleDestroyAndDisconnectSpecificSession(MessageParcel& data, MessageParcel& reply) { - uint64_t persistentId = data.ReadUint64(); + auto persistentId = data.ReadUint32(); const WSError& ret = DestroyAndDisconnectSpecificSession(persistentId); reply.WriteUint32(static_cast(ret)); return ERR_NONE; diff --git a/window_scene/session_manager/include/extension_session_manager.h b/window_scene/session_manager/include/extension_session_manager.h index 2d31276973..a6a689569e 100644 --- a/window_scene/session_manager/include/extension_session_manager.h +++ b/window_scene/session_manager/include/extension_session_manager.h @@ -63,7 +63,7 @@ private: sptr SetAbilitySessionInfo(const sptr& extensionSession); std::shared_ptr taskScheduler_; - std::map> extensionSessionMap_; + std::map> extensionSessionMap_; }; } // namespace OHOS::Rosen diff --git a/window_scene/session_manager/include/scene_session_manager.h b/window_scene/session_manager/include/scene_session_manager.h index 063b432c88..c84103d4f8 100644 --- a/window_scene/session_manager/include/scene_session_manager.h +++ b/window_scene/session_manager/include/scene_session_manager.h @@ -58,11 +58,11 @@ public: WSError RequestSceneSessionByCall(const sptr& sceneSession); void StartAbilityBySpecified(const SessionInfo& sessionInfo); sptr GetRootSceneSession(); - sptr GetSceneSession(uint64_t persistentId); + sptr GetSceneSession(uint32_t persistentId); WSError CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session); - WSError DestroyAndDisconnectSpecificSession(const uint64_t& persistentId); + sptr property, uint32_t& persistentId, sptr& session); + WSError DestroyAndDisconnectSpecificSession(const uint32_t& persistentId); WSError UpdateProperty(sptr& property, WSPropertyChangeAction action); void SetCreateSpecificSessionListener(const NotifyCreateSpecificSessionFunc& func); void SetGestureNavigationEnabledChangeListener(const ProcessGestureNavigationEnabledChangeFunc& func); @@ -77,16 +77,16 @@ public: WMError UnregisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent); - WSError SetFocusedSession(uint64_t persistentId); - uint64_t GetFocusedSession() const; + WSError SetFocusedSession(uint32_t persistentId); + uint32_t GetFocusedSession() const; WSError GetAllSessionDumpInfo(std::string& info); WSError GetSessionDumpInfo(const sptr& param, std::string& info); - WSError UpdateFocus(uint64_t persistentId, bool isFocused); + WSError UpdateFocus(uint32_t persistentId, bool isFocused); WSError SwitchUser(int32_t oldUserId, int32_t newUserId, std::string &fileDir); int32_t GetCurrentUserId() const; void StartWindowInfoReportLoop(); void GetFocusWindowInfo(FocusChangeInfo& focusInfo); - WSError SetSessionGravity(uint64_t persistentId, SessionGravity gravity, uint32_t percent); + WSError SetSessionGravity(uint32_t persistentId, SessionGravity gravity, uint32_t percent); WSError SetSessionLabel(const sptr &token, const std::string &label); WSError SetSessionIcon(const sptr &token, const std::shared_ptr &icon); WSError RegisterSessionListener(const sptr sessionListener); @@ -98,11 +98,11 @@ public: WSError PendingSessionToBackgroundForDelegator(const sptr &token); WSError GetFocusSessionToken(sptr &token); WSError TerminateSessionNew(const sptr info, bool needStartCaller); - WSError UpdateSessionAvoidAreaListener(uint64_t& persistentId, bool haveListener); + WSError UpdateSessionAvoidAreaListener(uint32_t& persistentId, bool haveListener); void UpdatePrivateStateAndNotify(bool isAddingPrivateSession); void InitPersistentStorage(); - std::string GetSessionSnapshot(uint64_t persistentId); + std::string GetSessionSnapshot(uint32_t persistentId); void OnOutsideDownEvent(int32_t x, int32_t y); WMError GetAccessibilityWindowInfo(std::vector>& infos); @@ -138,11 +138,11 @@ private: sptr FindMainWindowWithToken(sptr targetToken); WSError UpdateParentSession(const sptr& sceneSession, sptr property); void UpdateCameraFloatWindowStatus(uint32_t accessTokenId, bool isShowing); - void UpdateFocusableProperty(uint64_t persistentId); + void UpdateFocusableProperty(uint32_t persistentId); std::vector> GetSceneSessionVectorByType(WindowType type); - bool UpdateSessionAvoidAreaIfNeed(const uint64_t& persistentId, + bool UpdateSessionAvoidAreaIfNeed(const uint32_t& persistentId, const AvoidArea& avoidArea, AvoidAreaType avoidAreaType); - bool UpdateAvoidArea(const uint64_t& persistentId); + bool UpdateAvoidArea(const uint32_t& persistentId); sptr GetBundleManager(); std::shared_ptr CreateResourceManager( @@ -152,12 +152,12 @@ private: const WindowSceneConfig::ConfigItem& curveConfig, const std::string& nodeName = "keyboardAnimation"); WSError SetBrightness(const sptr& sceneSession, float brightness); - WSError UpdateBrightness(uint64_t persistentId); + WSError UpdateBrightness(uint32_t persistentId); void SetDisplayBrightness(float brightness); float GetDisplayBrightness() const; void HandleUpdateProperty(const sptr& property, WSPropertyChangeAction action, const sptr& sceneSession); - void NotifyWindowInfoChange(uint64_t persistentId, WindowUpdateType type); + void NotifyWindowInfoChange(uint32_t persistentId, WindowUpdateType type); void FillWindowInfo(std::vector>& infos, const sptr sceneSession); std::vector> GetWindowVisibilityChangeInfo( @@ -165,24 +165,24 @@ private: void WindowVisibilityChangeCallback(std::shared_ptr occlusiontionData); void WindowDestroyNotifyVisibility(const sptr& sceneSession); void RegisterSessionRectChangeNotifyManagerFunc(sptr& sceneSession); - void OnSessionRectChange(uint64_t persistentId, const WSRect& rect); + void OnSessionRectChange(uint32_t persistentId, const WSRect& rect); void RegisterInputMethodShownFunc(const sptr& sceneSession); - void OnInputMethodShown(const uint64_t& persistentId); + void OnInputMethodShown(const uint32_t& persistentId); void RegisterInputMethodHideFunc(const sptr& sceneSession); sptr rootSceneSession_; - std::map> sceneSessionMap_; + std::map> sceneSessionMap_; std::set> avoidAreaListenerSessionSet_; - std::map> lastUpdatedAvoidArea_; + std::map> lastUpdatedAvoidArea_; NotifyCreateSpecificSessionFunc createSpecificSessionFunc_; ProcessGestureNavigationEnabledChangeFunc gestureNavigationEnabledChangeFunc_; ProcessOutsideDownEventFunc outsideDownEventFunc_; AppWindowSceneConfig appWindowSceneConfig_; SystemSessionConfig systemConfig_; - uint64_t activeSessionId_ = INVALID_SESSION_ID; - uint64_t focusedSessionId_ = INVALID_SESSION_ID; - uint64_t brightnessSessionId_ = INVALID_SESSION_ID; + uint32_t activeSessionId_ = INVALID_SESSION_ID; + uint32_t focusedSessionId_ = INVALID_SESSION_ID; + uint32_t brightnessSessionId_ = INVALID_SESSION_ID; float displayBrightness_ = UNDEFINED_BRIGHTNESS; WSRect callingWindowRestoringRect_ = {0, 0, 0, 0}; int32_t currentUserId_; @@ -196,7 +196,7 @@ private: std::shared_ptr lastOcclusionData_ = std::make_shared(); RSInterfaces& rsInterface_; void RegisterSessionStateChangeNotifyManagerFunc(sptr& sceneSession); - void OnSessionStateChange(uint64_t persistentId); + void OnSessionStateChange(uint32_t persistentId); sptr sessionListener_; sptr FindSessionByToken(const sptr &token); diff --git a/window_scene/session_manager/include/session_manager.h b/window_scene/session_manager/include/session_manager.h index 2fb1d4aabf..d235d55ba4 100644 --- a/window_scene/session_manager/include/session_manager.h +++ b/window_scene/session_manager/include/session_manager.h @@ -30,10 +30,10 @@ WM_DECLARE_SINGLE_INSTANCE_BASE(SessionManager); public: void CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session); - void DestroyAndDisconnectSpecificSession(const uint64_t& persistentId); + sptr property, uint32_t& persistentId, sptr& session); + void DestroyAndDisconnectSpecificSession(const uint32_t& persistentId); WMError UpdateProperty(sptr& property, WSPropertyChangeAction action); - WMError SetSessionGravity(uint64_t persistentId, SessionGravity gravity, uint32_t percent); + WMError SetSessionGravity(uint32_t persistentId, SessionGravity gravity, uint32_t percent); WMError BindDialogTarget(uint64_t persistentId, sptr targetToken); sptr GetSceneSessionManagerProxy(); diff --git a/window_scene/session_manager/include/zidl/scene_session_manager_interface.h b/window_scene/session_manager/include/zidl/scene_session_manager_interface.h index 04200a598a..fa5d0b1e3e 100644 --- a/window_scene/session_manager/include/zidl/scene_session_manager_interface.h +++ b/window_scene/session_manager/include/zidl/scene_session_manager_interface.h @@ -64,11 +64,11 @@ public: virtual WSError CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) = 0; - virtual WSError DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) = 0; + sptr property, uint32_t& persistentId, sptr& session) = 0; + virtual WSError DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) = 0; virtual WSError UpdateProperty(sptr& property, WSPropertyChangeAction action) = 0; virtual WSError BindDialogTarget(uint64_t persistentId, sptr targetToken) = 0; - virtual WSError SetSessionGravity(uint64_t persistentId, SessionGravity gravity, uint32_t percent) = 0; + virtual WSError SetSessionGravity(uint32_t persistentId, SessionGravity gravity, uint32_t percent) = 0; virtual WSError SetSessionLabel(const sptr &token, const std::string &label) = 0; virtual WSError SetSessionIcon(const sptr &token, const std::shared_ptr &icon) = 0; virtual WSError RegisterSessionListener(const sptr sessionListener) = 0; diff --git a/window_scene/session_manager/include/zidl/scene_session_manager_proxy.h b/window_scene/session_manager/include/zidl/scene_session_manager_proxy.h index 413a00b17a..a0c07b4a97 100644 --- a/window_scene/session_manager/include/zidl/scene_session_manager_proxy.h +++ b/window_scene/session_manager/include/zidl/scene_session_manager_proxy.h @@ -29,8 +29,8 @@ public: WSError CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) override; - WSError DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) override; + sptr property, uint32_t& persistentId, sptr& session) override; + WSError DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) override; WSError UpdateProperty(sptr& property, WSPropertyChangeAction action) override; WSError BindDialogTarget(uint64_t persistentId, sptr targetToken) override; @@ -39,7 +39,7 @@ public: WMError UnregisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent) override; void GetFocusWindowInfo(FocusChangeInfo& focusInfo) override; - WSError SetSessionGravity(uint64_t persistentId, SessionGravity gravity, uint32_t percent) override; + WSError SetSessionGravity(uint32_t persistentId, SessionGravity gravity, uint32_t percent) override; WMError SetGestureNavigaionEnabled(bool enable) override; WSError SetSessionLabel(const sptr &token, const std::string &label) override; WSError SetSessionIcon(const sptr &token, const std::shared_ptr &icon) override; @@ -51,11 +51,11 @@ public: WSError GetFocusSessionToken(sptr &token) override; WSError TerminateSessionNew(const sptr info, bool needStartCaller) override; WSError GetSessionDumpInfo(const sptr ¶m, std::string& info) override; - WSError UpdateSessionAvoidAreaListener(uint64_t& persistentId, bool haveListener) override; + WSError UpdateSessionAvoidAreaListener(uint32_t& persistentId, bool haveListener) override; private: static inline BrokerDelegator delegator_; }; } // namespace OHOS::Rosen -#endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_PROXY_H \ No newline at end of file +#endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_PROXY_H diff --git a/window_scene/session_manager/include/zidl/session_listener_interface.h b/window_scene/session_manager/include/zidl/session_listener_interface.h index f51d98cc3c..67aaf31792 100644 --- a/window_scene/session_manager/include/zidl/session_listener_interface.h +++ b/window_scene/session_manager/include/zidl/session_listener_interface.h @@ -27,8 +27,8 @@ class ISessionListener : public IRemoteBroker { public: DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ISessionListener"); - virtual void OnSessionLabelChange(int persistentId, const std::string &label) = 0; - virtual void OnSessionIconChange(int persistentId, const std::shared_ptr &icon) = 0; + virtual void OnSessionLabelChange(uint32_t persistentId, const std::string &label) = 0; + virtual void OnSessionIconChange(uint32_t persistentId, const std::shared_ptr &icon) = 0; }; } // namespace OHOS::Rosen #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_LISTENER_INTERFACE_H \ No newline at end of file diff --git a/window_scene/session_manager/include/zidl/session_listener_proxy.h b/window_scene/session_manager/include/zidl/session_listener_proxy.h index 66cc2aa32b..73a904a753 100644 --- a/window_scene/session_manager/include/zidl/session_listener_proxy.h +++ b/window_scene/session_manager/include/zidl/session_listener_proxy.h @@ -26,8 +26,8 @@ public: : IRemoteProxy(impl) {}; ~SessionListenerProxy() {}; - virtual void OnSessionLabelChange(int persistentId, const std::string &label) override; - virtual void OnSessionIconChange(int persistentId, const std::shared_ptr &icon) override; + virtual void OnSessionLabelChange(uint32_t persistentId, const std::string &label) override; + virtual void OnSessionIconChange(uint32_t persistentId, const std::shared_ptr &icon) override; }; } // namespace OHOS::Rosen #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_LISTENER_PROXY_H \ No newline at end of file diff --git a/window_scene/session_manager/src/extension_session_manager.cpp b/window_scene/session_manager/src/extension_session_manager.cpp index 4434fa1bf3..7c09b89847 100644 --- a/window_scene/session_manager/src/extension_session_manager.cpp +++ b/window_scene/session_manager/src/extension_session_manager.cpp @@ -70,7 +70,7 @@ sptr ExtensionSessionManager::RequestExtensionSession(const Se return extensionSession; } auto persistentId = extensionSession->GetPersistentId(); - WLOGFI("create session persistentId: %{public}" PRIu64 ", bundleName: %{public}s, abilityName: %{public}s", + WLOGFI("create session persistentId: %{public}" PRIu32 ", bundleName: %{public}s, abilityName: %{public}s", persistentId, sessionInfo.bundleName_.c_str(), sessionInfo.abilityName_.c_str()); extensionSessionMap_.insert({ persistentId, extensionSession }); return extensionSession; @@ -90,7 +90,7 @@ WSError ExtensionSessionManager::RequestExtensionSessionActivation(const sptrGetPersistentId(); - WLOGFI("Activate session with persistentId: %{public}" PRIu64, persistentId); + WLOGFI("Activate session with persistentId: %{public}" PRIu32, persistentId); if (extensionSessionMap_.count(persistentId) == 0) { WLOGFE("Session is invalid!"); return WSError::WS_ERROR_INVALID_SESSION; @@ -119,7 +119,7 @@ WSError ExtensionSessionManager::RequestExtensionSessionBackground(const sptrGetPersistentId(); - WLOGFI("Background session with persistentId: %{public}" PRIu64, persistentId); + WLOGFI("Background session with persistentId: %{public}" PRIu32, persistentId); extSession->SetActive(false); extSession->Background(); if (extensionSessionMap_.count(persistentId) == 0) { @@ -149,7 +149,7 @@ WSError ExtensionSessionManager::RequestExtensionSessionDestruction(const sptrGetPersistentId(); - WLOGFI("Destroy session with persistentId: %{public}" PRIu64, persistentId); + WLOGFI("Destroy session with persistentId: %{public}" PRIu32, persistentId); extSession->Disconnect(); if (extensionSessionMap_.count(persistentId) == 0) { WLOGFE("Session is invalid!"); diff --git a/window_scene/session_manager/src/scene_session_manager.cpp b/window_scene/session_manager/src/scene_session_manager.cpp index aaa417077a..02a66e64de 100644 --- a/window_scene/session_manager/src/scene_session_manager.cpp +++ b/window_scene/session_manager/src/scene_session_manager.cpp @@ -516,12 +516,12 @@ sptr SceneSessionManager::GetRootSceneSession() return taskScheduler_->PostSyncTask(task); } -sptr SceneSessionManager::GetSceneSession(uint64_t persistentId) +sptr SceneSessionManager::GetSceneSession(uint32_t persistentId) { return taskScheduler_->PostSyncTask([this, persistentId]() -> sptr { auto iter = sceneSessionMap_.find(persistentId); if (iter == sceneSessionMap_.end()) { - WLOGFE("Error found scene session with id: %{public}" PRIu64, persistentId); + WLOGFE("Error found scene session with id: %{public}" PRIu32, persistentId); return nullptr; } return iter->second; @@ -577,7 +577,7 @@ sptr SceneSessionManager::RequestSceneSession(const SessionInfo& s if (sessionInfo.persistentId_ != 0) { auto session = GetSceneSession(sessionInfo.persistentId_); if (session != nullptr) { - WLOGFI("get exist session persistentId: %{public}" PRIu64 "", sessionInfo.persistentId_); + WLOGFI("get exist session persistentId: %{public}" PRIu32 "", sessionInfo.persistentId_); return session; } } @@ -611,7 +611,7 @@ sptr SceneSessionManager::RequestSceneSession(const SessionInfo& s sceneSession->SetCallingUid(IPCSkeleton::GetCallingUid()); } auto persistentId = sceneSession->GetPersistentId(); - HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSession(%" PRIu64" )", persistentId); + HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSession(%" PRIu32" )", persistentId); sceneSession->SetSystemConfig(systemConfig_); UpdateParentSession(sceneSession, property); sceneSessionMap_.insert({ persistentId, sceneSession }); @@ -619,7 +619,7 @@ sptr SceneSessionManager::RequestSceneSession(const SessionInfo& s RegisterSessionRectChangeNotifyManagerFunc(sceneSession); RegisterInputMethodShownFunc(sceneSession); RegisterInputMethodHideFunc(sceneSession); - WLOGFI("create session persistentId: %{public}" PRIu64 "", persistentId); + WLOGFI("create session persistentId: %{public}" PRIu32 "", persistentId); return sceneSession; }; @@ -632,14 +632,14 @@ void SceneSessionManager::RegisterInputMethodShownFunc(const sptr& WLOGFE("session is nullptr"); return; } - NotifyCallingSessionForegroundFunc onInputMethodShown = [this](uint64_t persistentId) { + NotifyCallingSessionForegroundFunc onInputMethodShown = [this](uint32_t persistentId) { this->OnInputMethodShown(persistentId); }; sceneSession->SetNotifyCallingSessionForegroundFunc(onInputMethodShown); WLOGFD("RegisterInputMethodShownFunc success"); } -void SceneSessionManager::OnInputMethodShown(const uint64_t& persistentId) +void SceneSessionManager::OnInputMethodShown(const uint32_t& persistentId) { WLOGFD("Resize input method calling window"); auto scnSession = GetSceneSession(persistentId); @@ -698,10 +698,10 @@ WSError SceneSessionManager::RequestSceneSessionActivation(const sptrGetPersistentId(); - HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSessionActivation(%" PRIu64" )", persistentId); - WLOGFI("active persistentId: %{public}" PRIu64 "", persistentId); + HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSessionActivation(%" PRIu32" )", persistentId); + WLOGFI("active persistentId: %{public}" PRIu32 "", persistentId); if (sceneSessionMap_.count(persistentId) == 0) { - WLOGFE("session is invalid with %{public}" PRIu64 "", persistentId); + WLOGFE("session is invalid with %{public}" PRIu32 "", persistentId); return WSError::WS_ERROR_INVALID_SESSION; } auto scnSessionInfo = SetAbilitySessionInfo(scnSession); @@ -729,12 +729,12 @@ WSError SceneSessionManager::RequestSceneSessionBackground(const sptrGetPersistentId(); - WLOGFI("background session persistentId: %{public}" PRIu64 "", persistentId); - HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSessionBackground (%" PRIu64" )", persistentId); + WLOGFI("background session persistentId: %{public}" PRIu32 "", persistentId); + HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSessionBackground (%" PRIu32" )", persistentId); scnSession->SetActive(false); scnSession->Background(); if (sceneSessionMap_.count(persistentId) == 0) { - WLOGFE("session is invalid with %{public}" PRIu64 "", persistentId); + WLOGFE("session is invalid with %{public}" PRIu32 "", persistentId); return WSError::WS_ERROR_INVALID_SESSION; } if (persistentId == brightnessSessionId_) { @@ -770,7 +770,7 @@ WSError SceneSessionManager::DestroyDialogWithMainWindow(const sptrGetPersistentId()) == 0) { - WLOGFE("session is invalid with %{public}" PRIu64 "", dialog->GetPersistentId()); + WLOGFE("session is invalid with %{public}" PRIu32 "", dialog->GetPersistentId()); return WSError::WS_ERROR_INVALID_SESSION; } auto sceneSession = GetSceneSession(dialog->GetPersistentId()); @@ -796,12 +796,12 @@ WSError SceneSessionManager::RequestSceneSessionDestruction(const sptrGetPersistentId(); DestroyDialogWithMainWindow(scnSession); - WLOGFI("destroy session persistentId: %{public}" PRIu64 "", persistentId); - HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSessionDestruction (%" PRIu64" )", persistentId); + WLOGFI("destroy session persistentId: %{public}" PRIu32 "", persistentId); + HITRACE_METER_FMT(HITRACE_TAG_WINDOW_MANAGER, "ssm:RequestSceneSessionDestruction (%" PRIu32" )", persistentId); WindowDestroyNotifyVisibility(scnSession); scnSession->Disconnect(); if (sceneSessionMap_.count(persistentId) == 0) { - WLOGFE("session is invalid with %{public}" PRIu64 "", persistentId); + WLOGFE("session is invalid with %{public}" PRIu32 "", persistentId); return WSError::WS_ERROR_INVALID_SESSION; } auto scnSessionInfo = SetAbilitySessionInfo(scnSession); @@ -820,7 +820,7 @@ WSError SceneSessionManager::RequestSceneSessionDestruction(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) + sptr property, uint32_t& persistentId, sptr& session) { if (!SessionPermission::IsSystemCalling() && !SessionPermission::IsStartedByInputMethod()) { WLOGFE("check input method permission failed"); @@ -881,10 +881,10 @@ void SceneSessionManager::SetOutsideDownEventListener(const ProcessOutsideDownEv outsideDownEventFunc_ = func; } -WSError SceneSessionManager::DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) +WSError SceneSessionManager::DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) { auto task = [this, persistentId]() { - WLOGFI("Destroy specific session persistentId: %{public}" PRIu64, persistentId); + WLOGFI("Destroy specific session persistentId: %{public}" PRIu32, persistentId); auto sceneSession = GetSceneSession(persistentId); if (sceneSession == nullptr) { return WSError::WS_ERROR_NULLPTR; @@ -921,7 +921,7 @@ WSError SceneSessionManager::ProcessBackEvent() if (!session) { return WSError::WS_ERROR_INVALID_SESSION; } - WLOGFD("ProcessBackEvent session persistentId: %{public}" PRIu64 "", activeSessionId_); + WLOGFD("ProcessBackEvent session persistentId: %{public}" PRIu32 "", activeSessionId_); session->ProcessBackEvent(); return WSError::WS_OK; }; @@ -1060,7 +1060,7 @@ WSError SceneSessionManager::UpdateProperty(sptr& propert if (sceneSession == nullptr) { return; } - WLOGI("Id: %{public}" PRIu64 ", action: %{public}u", sceneSession->GetPersistentId(), action); + WLOGI("Id: %{public}" PRIu32 ", action: %{public}u", sceneSession->GetPersistentId(), action); HandleUpdateProperty(property, action, sceneSession); }; taskScheduler_->PostAsyncTask(task); @@ -1224,7 +1224,7 @@ WSError SceneSessionManager::SetBrightness(const sptr& sceneSessio return WSError::WS_OK; } -WSError SceneSessionManager::UpdateBrightness(uint64_t persistentId) +WSError SceneSessionManager::UpdateBrightness(uint32_t persistentId) { auto sceneSession = GetSceneSession(persistentId); if (sceneSession == nullptr) { @@ -1289,10 +1289,10 @@ WMError SceneSessionManager::SetGestureNavigaionEnabled(bool enable) return taskScheduler_->PostSyncTask(task); } -WSError SceneSessionManager::SetFocusedSession(uint64_t persistentId) +WSError SceneSessionManager::SetFocusedSession(uint32_t persistentId) { if (focusedSessionId_ == persistentId) { - WLOGI("Focus scene not change, id: %{public}" PRIu64, focusedSessionId_); + WLOGI("Focus scene not change, id: %{public}" PRIu32, focusedSessionId_); return WSError::WS_DO_NOTHING; } focusedSessionId_ = persistentId; @@ -1300,7 +1300,7 @@ WSError SceneSessionManager::SetFocusedSession(uint64_t persistentId) return WSError::WS_OK; } -uint64_t SceneSessionManager::GetFocusedSession() const +uint32_t SceneSessionManager::GetFocusedSession() const { return focusedSessionId_; } @@ -1374,10 +1374,10 @@ WSError SceneSessionManager::GetSessionDumpInfo(const sptr& param, st return GetAllSessionDumpInfo(info); } -WSError SceneSessionManager::UpdateFocus(uint64_t persistentId, bool isFocused) +WSError SceneSessionManager::UpdateFocus(uint32_t persistentId, bool isFocused) { auto task = [this, persistentId, isFocused]() { - WLOGFD("Update focus, id: %{public}" PRIu64", isFocused: %{public}u", persistentId, static_cast(isFocused)); + WLOGFD("Update focus, id: %{public}" PRIu32", isFocused: %{public}u", persistentId, static_cast(isFocused)); // notify session and client auto sceneSession = GetSceneSession(persistentId); if (sceneSession == nullptr) { @@ -1428,7 +1428,7 @@ void SceneSessionManager::RegisterSessionRectChangeNotifyManagerFunc(sptrGetPersistentId(); + auto persistentId = sceneSession->GetPersistentId(); NotifySessionRectChangeFunc onRectChange = [this, persistentId](const WSRect& rect) { this->OnSessionRectChange(persistentId, rect); }; @@ -1440,7 +1440,7 @@ void SceneSessionManager::RegisterSessionRectChangeNotifyManagerFunc(sptr& sceneSession) { - NotifySessionStateChangeNotifyManagerFunc func = [this](int64_t persistentId) { + NotifySessionStateChangeNotifyManagerFunc func = [this](uint32_t persistentId) { this->OnSessionStateChange(persistentId); }; if (sceneSession == nullptr) { @@ -1451,9 +1451,9 @@ void SceneSessionManager::RegisterSessionStateChangeNotifyManagerFunc(sptr& return WSError::WS_ERROR_NULLPTR; } auto persistentId = scnSession->GetPersistentId(); - WLOGFI("RequestSceneSessionByCall persistentId: %{public}" PRIu64 "", persistentId); + WLOGFI("RequestSceneSessionByCall persistentId: %{public}" PRIu32 "", persistentId); if (sceneSessionMap_.count(persistentId) == 0) { - WLOGFE("session is invalid with %{public}" PRIu64 "", persistentId); + WLOGFE("session is invalid with %{public}" PRIu32 "", persistentId); return WSError::WS_ERROR_INVALID_SESSION; } auto sessionInfo = scnSession->GetSessionInfo(); - WLOGFI("RequestSceneSessionByCall callState:%{public}d, persistentId: %{public}" PRIu64 "", + WLOGFI("RequestSceneSessionByCall callState:%{public}d, persistentId: %{public}" PRIu32 "", sessionInfo.callState_, persistentId); auto abilitySessionInfo = SetAbilitySessionInfo(scnSession); if (!abilitySessionInfo) { @@ -1676,7 +1676,7 @@ WSError SceneSessionManager::BindDialogTarget(uint64_t persistentId, sptr(persistentId)); if (scnSession == nullptr) { WLOGFE("Session is nullptr"); return WSError::WS_ERROR_NULLPTR; @@ -1692,7 +1692,7 @@ WSError SceneSessionManager::BindDialogTarget(uint64_t persistentId, sptrSetParentSession(parentSession); - WLOGFD("Bind dialog success, dialog id %{public}" PRIu64 ", parent id %{public}" PRIu64 "", + WLOGFD("Bind dialog success, dialog id %{public}" PRIu64 ", parent id %{public}" PRIu32 "", persistentId, parentSession->GetPersistentId()); return WSError::WS_OK; } @@ -1802,7 +1802,7 @@ void SceneSessionManager::RestoreCallingSessionSizeIfNeed() callingWindowRestoringRect_ = { 0, 0, 0, 0 }; } -WSError SceneSessionManager::SetSessionGravity(uint64_t persistentId, SessionGravity gravity, uint32_t percent) +WSError SceneSessionManager::SetSessionGravity(uint32_t persistentId, SessionGravity gravity, uint32_t percent) { auto sceneSession = GetSceneSession(persistentId); if (!sceneSession) { @@ -1870,7 +1870,7 @@ void SceneSessionManager::InitPersistentStorage() } } -void SceneSessionManager::OnSessionRectChange(uint64_t persistentId, const WSRect& rect) +void SceneSessionManager::OnSessionRectChange(uint32_t persistentId, const WSRect& rect) { WLOGFI("OnSessionRectChange"); NotifyWindowInfoChange(persistentId, WindowUpdateType::WINDOW_UPDATE_BOUNDS); @@ -1879,19 +1879,19 @@ void SceneSessionManager::OnSessionRectChange(uint64_t persistentId, const WSRec WMError SceneSessionManager::GetAccessibilityWindowInfo(std::vector>& infos) { WLOGFI("GetAccessibilityWindowInfo Called."); - std::map>::iterator iter; + std::map>::iterator iter; for (iter = sceneSessionMap_.begin(); iter != sceneSessionMap_.end(); iter++) { FillWindowInfo(infos, iter->second); } return WMError::WM_OK; } -void SceneSessionManager::NotifyWindowInfoChange(uint64_t persistentId, WindowUpdateType type) +void SceneSessionManager::NotifyWindowInfoChange(uint32_t persistentId, WindowUpdateType type) { std::vector> infos; auto iter = sceneSessionMap_.find(persistentId); if (iter == sceneSessionMap_.end()) { - WLOGFW("Error find session for id = %{public}" PRIu64, persistentId); + WLOGFW("Error find session for id = %{public}" PRIu32, persistentId); return; } @@ -1908,7 +1908,7 @@ void SceneSessionManager::FillWindowInfo(std::vector info = new (std::nothrow) AccessibilityWindowInfo(); - info->wid_ = static_cast(sceneSession->GetPersistentId()); + info->wid_ = static_cast(sceneSession->GetPersistentId()); WSRect wsrect = sceneSession->GetSessionRect(); info->windowRect_ = {wsrect.posX_, wsrect.posY_, wsrect.width_, wsrect.height_ }; info->focused_ = sceneSession->GetPersistentId() == focusedSessionId_; @@ -1923,9 +1923,9 @@ void SceneSessionManager::FillWindowInfo(std::vector &token) { - WLOGFI("run GetFocusSessionToken with focusedSessionId: %{public}" PRIu64, focusedSessionId_); + WLOGFI("run GetFocusSessionToken with focusedSessionId: %{public}" PRIu32, focusedSessionId_); auto sceneSession = GetSceneSession(focusedSessionId_); if (sceneSession) { token = sceneSession->GetAbilityToken(); @@ -2113,9 +2113,9 @@ WSError SceneSessionManager::GetFocusSessionToken(sptr &token) return WSError::WS_ERROR_INVALID_PARAM; } -WSError SceneSessionManager::UpdateSessionAvoidAreaListener(uint64_t& persistentId, bool haveListener) +WSError SceneSessionManager::UpdateSessionAvoidAreaListener(uint32_t& persistentId, bool haveListener) { - WLOGFI("UpdateSessionAvoidAreaListener persistentId: %{public}" PRIu64 " haveListener:%{public}d", + WLOGFI("UpdateSessionAvoidAreaListener persistentId: %{public}" PRIu32 " haveListener:%{public}d", persistentId, haveListener); auto sceneSession = GetSceneSession(persistentId); if (sceneSession == nullptr) { @@ -2131,7 +2131,7 @@ WSError SceneSessionManager::UpdateSessionAvoidAreaListener(uint64_t& persistent return WSError::WS_OK; } -bool SceneSessionManager::UpdateSessionAvoidAreaIfNeed(const uint64_t& persistentId, +bool SceneSessionManager::UpdateSessionAvoidAreaIfNeed(const uint32_t& persistentId, const AvoidArea& avoidArea, AvoidAreaType avoidAreaType) { auto iter = lastUpdatedAvoidArea_.find(persistentId); @@ -2164,7 +2164,7 @@ bool SceneSessionManager::UpdateSessionAvoidAreaIfNeed(const uint64_t& persisten return needUpdate; } -bool SceneSessionManager::UpdateAvoidArea(const uint64_t& persistentId) +bool SceneSessionManager::UpdateAvoidArea(const uint32_t& persistentId) { bool needUpdate = true; auto sceneSession = GetSceneSession(persistentId); @@ -2189,7 +2189,7 @@ bool SceneSessionManager::UpdateAvoidArea(const uint64_t& persistentId) } } else { if (avoidAreaListenerSessionSet_.find(sceneSession) == avoidAreaListenerSessionSet_.end()) { - WLOGD("id:%{public}" PRIu64" is not in avoidAreaListenerNodes, don't update avoid area.", persistentId); + WLOGD("id:%{public}" PRIu32" is not in avoidAreaListenerNodes, don't update avoid area.", persistentId); return false; } uint32_t start = static_cast(AvoidAreaType::TYPE_SYSTEM); @@ -2203,4 +2203,4 @@ bool SceneSessionManager::UpdateAvoidArea(const uint64_t& persistentId) return needUpdate; } -} // namespace OHOS::Rosen \ No newline at end of file +} // namespace OHOS::Rosen diff --git a/window_scene/session_manager/src/session_manager.cpp b/window_scene/session_manager/src/session_manager.cpp index b5baca43c8..b80b9498c6 100644 --- a/window_scene/session_manager/src/session_manager.cpp +++ b/window_scene/session_manager/src/session_manager.cpp @@ -116,7 +116,7 @@ void SessionManager::InitSceneSessionManagerProxy() void SessionManager::CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) + sptr property, uint32_t& persistentId, sptr& session) { WLOGFD("CreateAndConnectSpecificSession"); GetSceneSessionManagerProxy(); @@ -128,7 +128,7 @@ void SessionManager::CreateAndConnectSpecificSession(const sptr& surfaceNode, property, persistentId, session); } -void SessionManager::DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) +void SessionManager::DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) { WLOGFD("DestroyAndDisconnectSpecificSession"); GetSceneSessionManagerProxy(); @@ -150,7 +150,7 @@ WMError SessionManager::UpdateProperty(sptr& property, WS return static_cast(sceneSessionManagerProxy_->UpdateProperty(property, action)); } -WMError SessionManager::SetSessionGravity(uint64_t persistentId, SessionGravity gravity, uint32_t percent) +WMError SessionManager::SetSessionGravity(uint32_t persistentId, SessionGravity gravity, uint32_t percent) { WLOGFD("SetWindowGravity"); InitSceneSessionManagerProxy(); diff --git a/window_scene/session_manager/src/zidl/scene_session_manager_proxy.cpp b/window_scene/session_manager/src/zidl/scene_session_manager_proxy.cpp index dbc9632f81..497b3bccfc 100644 --- a/window_scene/session_manager/src/zidl/scene_session_manager_proxy.cpp +++ b/window_scene/session_manager/src/zidl/scene_session_manager_proxy.cpp @@ -30,7 +30,7 @@ constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "SceneSe } WSError SceneSessionManagerProxy::CreateAndConnectSpecificSession(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session) + sptr property, uint32_t& persistentId, sptr& session) { MessageOption option(MessageOption::TF_SYNC); MessageParcel data; @@ -70,7 +70,7 @@ WSError SceneSessionManagerProxy::CreateAndConnectSpecificSession(const sptr sessionObject = reply.ReadRemoteObject(); if (sessionObject == nullptr) { WLOGFE("ReadRemoteObject failed"); @@ -81,7 +81,7 @@ WSError SceneSessionManagerProxy::CreateAndConnectSpecificSession(const sptr(ret); } -WSError SceneSessionManagerProxy::DestroyAndDisconnectSpecificSession(const uint64_t& persistentId) +WSError SceneSessionManagerProxy::DestroyAndDisconnectSpecificSession(const uint32_t& persistentId) { MessageParcel data; MessageParcel reply; @@ -90,8 +90,8 @@ WSError SceneSessionManagerProxy::DestroyAndDisconnectSpecificSession(const uint WLOGFE("WriteInterfaceToken failed"); return WSError::WS_ERROR_IPC_FAILED; } - if (!data.WriteUint64(persistentId)) { - WLOGFE("Write uint64_t failed"); + if (!data.WriteUint32(persistentId)) { + WLOGFE("Write persistentId failed"); } if (Remote()->SendRequest(static_cast( SceneSessionManagerMessage::TRANS_ID_DESTROY_AND_DISCONNECT_SPECIFIC_SESSION), @@ -167,7 +167,7 @@ WSError SceneSessionManagerProxy::BindDialogTarget(uint64_t persistentId, sptr(ret); } -WSError SceneSessionManagerProxy::UpdateSessionAvoidAreaListener(uint64_t& persistentId, bool haveListener) +WSError SceneSessionManagerProxy::UpdateSessionAvoidAreaListener(uint32_t& persistentId, bool haveListener) { MessageParcel data; MessageParcel reply; @@ -177,7 +177,7 @@ WSError SceneSessionManagerProxy::UpdateSessionAvoidAreaListener(uint64_t& persi WLOGFE("WriteInterfaceToken failed"); return WSError::WS_ERROR_IPC_FAILED; } - if (!data.WriteUint64(persistentId)) { + if (!data.WriteUint32(persistentId)) { WLOGFE("Write persistentId failed"); return WSError::WS_ERROR_IPC_FAILED; } @@ -275,7 +275,7 @@ void SceneSessionManagerProxy::GetFocusWindowInfo(FocusChangeInfo& focusInfo) focusInfo = *info; } -WSError SceneSessionManagerProxy::SetSessionGravity(uint64_t persistentId, SessionGravity gravity, uint32_t percent) +WSError SceneSessionManagerProxy::SetSessionGravity(uint32_t persistentId, SessionGravity gravity, uint32_t percent) { MessageParcel data; MessageParcel reply; @@ -290,7 +290,7 @@ WSError SceneSessionManagerProxy::SetSessionGravity(uint64_t persistentId, Sessi WLOGFE("SendRequest failed"); return WSError::WS_ERROR_IPC_FAILED; } - if (!data.WriteUint64(persistentId)) { + if (!data.WriteUint32(persistentId)) { WLOGFE("Write PropertyChangeAction failed"); return WSError::WS_ERROR_IPC_FAILED; } @@ -599,4 +599,4 @@ WSError SceneSessionManagerProxy::GetSessionDumpInfo(const sptr ¶ info = reply.ReadString(); return static_cast(reply.ReadInt32()); } -} // namespace OHOS::Rosen \ No newline at end of file +} // namespace OHOS::Rosen diff --git a/window_scene/session_manager/src/zidl/scene_session_manager_stub.cpp b/window_scene/session_manager/src/zidl/scene_session_manager_stub.cpp index 8f751e2ae0..f47cc12a25 100644 --- a/window_scene/session_manager/src/zidl/scene_session_manager_stub.cpp +++ b/window_scene/session_manager/src/zidl/scene_session_manager_stub.cpp @@ -104,14 +104,14 @@ int SceneSessionManagerStub::HandleCreateAndConnectSpecificSession(MessageParcel } else { WLOGFW("Property not exist!"); } - uint64_t persistentId = INVALID_SESSION_ID; + auto persistentId = INVALID_SESSION_ID; sptr sceneSession; CreateAndConnectSpecificSession(sessionStage, eventChannel, surfaceNode, property, persistentId, sceneSession); if (sceneSession== nullptr) { return ERR_INVALID_STATE; } - reply.WriteUint64(persistentId); + reply.WriteUint32(persistentId); reply.WriteRemoteObject(sceneSession->AsObject()); reply.WriteUint32(static_cast(WSError::WS_OK)); return ERR_NONE; @@ -120,7 +120,7 @@ int SceneSessionManagerStub::HandleCreateAndConnectSpecificSession(MessageParcel int SceneSessionManagerStub::HandleDestroyAndDisconnectSpcificSession(MessageParcel &data, MessageParcel &reply) { WLOGFI("run HandleDestroyAndDisconnectSpcificSession!"); - uint64_t persistentId = data.ReadUint64(); + auto persistentId = data.ReadUint32(); const WSError& ret = DestroyAndDisconnectSpecificSession(persistentId); reply.WriteUint32(static_cast(ret)); return ERR_NONE; @@ -281,7 +281,7 @@ int SceneSessionManagerStub::HandleGetAccessibilityWindowInfo(MessageParcel &dat int SceneSessionManagerStub::HandleSetSessionGravity(MessageParcel &data, MessageParcel &reply) { WLOGFI("run HandleSetSessionGravity!"); - uint64_t persistentId = data.ReadUint64(); + auto persistentId = data.ReadUint32(); SessionGravity gravity = static_cast(data.ReadUint32()); uint32_t percent = data.ReadUint32(); WSError ret = SetSessionGravity(persistentId, gravity, percent); @@ -302,7 +302,7 @@ int SceneSessionManagerStub::HandleGetSessionDump(MessageParcel &data, MessagePa int SceneSessionManagerStub::HandleUpdateSessionAvoidAreaListener(MessageParcel& data, MessageParcel& reply) { - uint64_t persistentId = data.ReadUint64(); + auto persistentId = data.ReadUint32(); bool haveAvoidAreaListener = data.ReadBool(); WSError errCode = UpdateSessionAvoidAreaListener(persistentId, haveAvoidAreaListener); reply.WriteUint32(static_cast(errCode)); @@ -312,10 +312,10 @@ int SceneSessionManagerStub::HandleUpdateSessionAvoidAreaListener(MessageParcel& int SceneSessionManagerStub::HandleBindDialogTarget(MessageParcel &data, MessageParcel &reply) { WLOGFI("run HandleBindDialogTarget!"); - uint64_t persistentId = data.ReadUint64(); + auto persistentId = data.ReadUint64(); sptr remoteObject = data.ReadRemoteObject(); const WSError& ret = BindDialogTarget(persistentId, remoteObject); reply.WriteUint32(static_cast(ret)); return ERR_NONE; } -} // namespace OHOS::Rosen \ No newline at end of file +} // namespace OHOS::Rosen diff --git a/window_scene/session_manager/src/zidl/session_listener_proxy.cpp b/window_scene/session_manager/src/zidl/session_listener_proxy.cpp index 0f98f7f029..1ef3fe4824 100644 --- a/window_scene/session_manager/src/zidl/session_listener_proxy.cpp +++ b/window_scene/session_manager/src/zidl/session_listener_proxy.cpp @@ -17,7 +17,7 @@ namespace OHOS::Rosen { -void SessionListenerProxy::OnSessionLabelChange(int persistentId, const std::string &label) {} -void SessionListenerProxy::OnSessionIconChange(int persistentId, const std::shared_ptr &icon) {} +void SessionListenerProxy::OnSessionLabelChange(uint32_t persistentId, const std::string &label) {} +void SessionListenerProxy::OnSessionIconChange(uint32_t persistentId, const std::shared_ptr &icon) {} } // namespace OHOS::Rosen \ No newline at end of file diff --git a/window_scene/test/mock/mock_session.h b/window_scene/test/mock/mock_session.h index 5b7c66adae..881b6494c6 100644 --- a/window_scene/test/mock/mock_session.h +++ b/window_scene/test/mock/mock_session.h @@ -29,7 +29,7 @@ public: SystemSessionConfig& systemConfig, sptr property, sptr token)); MOCK_METHOD6(CreateAndConnectSpecificSession, WSError(const sptr& sessionStage, const sptr& eventChannel, const std::shared_ptr& surfaceNode, - sptr property, uint64_t& persistentId, sptr& session)); + sptr property, uint32_t& persistentId, sptr& session)); MOCK_METHOD1(Foreground, WSError(sptr property)); MOCK_METHOD0(Background, WSError(void)); diff --git a/window_scene/test/unittest/session_test.cpp b/window_scene/test/unittest/session_test.cpp index 397295def6..c19cbf5b72 100644 --- a/window_scene/test/unittest/session_test.cpp +++ b/window_scene/test/unittest/session_test.cpp @@ -545,7 +545,7 @@ HWTEST_F(WindowSessionTest, DestroyAndDisconnectSpecificSession01, Function | Sm SessionInfo info; info.abilityName_ = "testSession1"; info.bundleName_ = "testSession3"; - uint64_t persistentId = 0; + uint32_t persistentId = 0; sptr scensession = new (std::nothrow) SceneSession(info, nullptr); EXPECT_NE(scensession, nullptr); auto result = scensession->DestroyAndDisconnectSpecificSession(persistentId); @@ -555,7 +555,7 @@ HWTEST_F(WindowSessionTest, DestroyAndDisconnectSpecificSession01, Function | Sm new (std::nothrow) SceneSession::SpecificSessionCallback(); EXPECT_NE(specificCallback_, nullptr); int resultValue = 0; - specificCallback_->onDestroy_ = [&resultValue](const uint64_t &persistentId) -> WSError + specificCallback_->onDestroy_ = [&resultValue](const uint32_t &persistentId) -> WSError { resultValue = 1; return WSError::WS_OK; @@ -579,7 +579,7 @@ HWTEST_F(WindowSessionTest, CreateAndConnectSpecificSession01, Function | SmallT sptr session_; auto surfaceNode_ = CreateRSSurfaceNode(); sptr property_ = nullptr; - uint64_t persistentId = 0; + uint32_t persistentId = 0; sptr mockSessionStage = new (std::nothrow) SessionStageMocker(); EXPECT_NE(mockSessionStage, nullptr); sptr specificCallback_ = @@ -630,7 +630,7 @@ HWTEST_F(WindowSessionTest, CreateAndConnectSpecificSession2, Function | SmallTe sptr session_; auto surfaceNode_ = CreateRSSurfaceNode(); sptr property_ = nullptr; - uint64_t persistentId = 0; + uint32_t persistentId = 0; sptr mockSessionStage = new (std::nothrow) SessionStageMocker(); EXPECT_NE(mockSessionStage, nullptr); sptr specificCallback_ = diff --git a/wm/include/window_adapter.h b/wm/include/window_adapter.h index 6d42fe0e62..0c2149beb7 100644 --- a/wm/include/window_adapter.h +++ b/wm/include/window_adapter.h @@ -83,7 +83,7 @@ public: virtual void SetMaximizeMode(MaximizeMode maximizeMode); virtual MaximizeMode GetMaximizeMode(); virtual void GetFocusWindowInfo(FocusChangeInfo& focusInfo); - virtual WMError UpdateSessionAvoidAreaListener(uint64_t& persistentId, bool haveListener); + virtual WMError UpdateSessionAvoidAreaListener(uint32_t& persistentId, bool haveListener); private: static inline SingletonDelegator delegator; bool InitWMSProxy(); diff --git a/wm/include/window_scene_session_impl.h b/wm/include/window_scene_session_impl.h index 3b95912b74..011c0113f5 100644 --- a/wm/include/window_scene_session_impl.h +++ b/wm/include/window_scene_session_impl.h @@ -102,7 +102,7 @@ protected: WMError CreateAndConnectSpecificSession(); sptr FindParentSessionByParentId(uint32_t parentId); sptr FindMainWindowWithContext(); - void UpdateSubWindowStateAndNotify(uint64_t parentPersistentId, const WindowState& newState); + void UpdateSubWindowStateAndNotify(uint32_t parentPersistentId, const WindowState& newState); void LimitCameraFloatWindowMininumSize(uint32_t& width, uint32_t& height); void UpdateFloatingWindowSizeBySizeLimits(uint32_t& width, uint32_t& height) const; WMError NotifyWindowSessionProperty(); diff --git a/wm/include/window_session_impl.h b/wm/include/window_session_impl.h index d029c1f887..0237260885 100644 --- a/wm/include/window_session_impl.h +++ b/wm/include/window_session_impl.h @@ -106,10 +106,10 @@ public: WMError SetBackgroundColor(const std::string& color) override; uint32_t GetParentId() const; - uint64_t GetPersistentId() const; + uint32_t GetPersistentId() const; sptr GetProperty() const; sptr GetHostSession() const; - uint64_t GetFloatingWindowParentId(); + uint32_t GetFloatingWindowParentId(); void NotifyAfterForeground(bool needNotifyListeners = true, bool needNotifyUiContent = true); void NotifyAfterBackground(bool needNotifyListeners = true, bool needNotifyUiContent = true); void NotifyForegroundFailed(WMError ret); @@ -130,7 +130,7 @@ protected: void NotifyAfterActive(); void NotifyAfterInactive(); void NotifyBeforeDestroy(std::string windowName); - void ClearListenersById(uint64_t persistentId); + void ClearListenersById(uint32_t persistentId); WMError WindowSessionCreateCheck(); void UpdateDecorEnable(bool needNotify = false); void NotifyModeChange(WindowMode mode, bool hasDeco = true); @@ -150,8 +150,8 @@ protected: NotifyNativeWinDestroyFunc notifyNativeFunc_; std::recursive_mutex mutex_; - static std::map>> windowSessionMap_; - static std::map>> subWindowSessionMap_; + static std::map>> windowSessionMap_; + static std::map>> subWindowSessionMap_; bool isIgnoreSafeAreaNeedNotify_ = false; bool isIgnoreSafeArea_ = false; @@ -169,7 +169,7 @@ private: EnableIfSame>> GetListeners(); template EnableIfSame>> GetListeners(); - template void ClearUselessListeners(std::map& listeners, uint64_t persistentId); + template void ClearUselessListeners(std::map& listeners, uint32_t persistentId); RSSurfaceNode::SharedPtr CreateSurfaceNode(std::string name, WindowType type); void NotifyAfterFocused(); void NotifyAfterUnfocused(bool needNotifyUiContent = true); @@ -177,11 +177,11 @@ private: void NotifySizeChange(Rect rect, WindowSizeChangeReason reason); static std::recursive_mutex globalMutex_; - static std::map>> lifecycleListeners_; - static std::map>> windowChangeListeners_; - static std::map>> avoidAreaChangeListeners_; - static std::map>> dialogDeathRecipientListeners_; - static std::map>> dialogTargetTouchListener_; + static std::map>> lifecycleListeners_; + static std::map>> windowChangeListeners_; + static std::map>> avoidAreaChangeListeners_; + static std::map>> dialogDeathRecipientListeners_; + static std::map>> dialogTargetTouchListener_; static std::map>> occupiedAreaChangeListeners_; std::optional> focusState_ = std::nullopt; diff --git a/wm/src/window_adapter.cpp b/wm/src/window_adapter.cpp index 8c750d1b5e..f989a66b49 100644 --- a/wm/src/window_adapter.cpp +++ b/wm/src/window_adapter.cpp @@ -376,7 +376,7 @@ void WindowAdapter::GetFocusWindowInfo(FocusChangeInfo& focusInfo) return windowManagerServiceProxy_->GetFocusWindowInfo(focusInfo); } -WMError WindowAdapter::UpdateSessionAvoidAreaListener(uint64_t& persistentId, bool haveListener) +WMError WindowAdapter::UpdateSessionAvoidAreaListener(uint32_t& persistentId, bool haveListener) { INIT_PROXY_CHECK_RETURN(WMError::WM_DO_NOTHING); return static_cast(windowManagerServiceProxy_->UpdateSessionAvoidAreaListener(persistentId, haveListener)); diff --git a/wm/src/window_extension_session_impl.cpp b/wm/src/window_extension_session_impl.cpp index 227f4343d4..8d9e95e491 100644 --- a/wm/src/window_extension_session_impl.cpp +++ b/wm/src/window_extension_session_impl.cpp @@ -49,7 +49,7 @@ WMError WindowExtensionSessionImpl::Create(const std::shared_ptrGetPersistentId(), x, y); + WLOGFD("Id:%{public}" PRIu32 " MoveTo %{public}d %{public}d", property_->GetPersistentId(), x, y); if (IsWindowSessionInvalid()) { WLOGFE("Window session invalid."); return WMError::WM_ERROR_INVALID_WINDOW; @@ -62,7 +62,7 @@ WMError WindowExtensionSessionImpl::MoveTo(int32_t x, int32_t y) WMError WindowExtensionSessionImpl::Resize(uint32_t width, uint32_t height) { - WLOGFD("Id:%{public}" PRIu64 " Resize %{public}u %{public}u", property_->GetPersistentId(), width, height); + WLOGFD("Id:%{public}" PRIu32 " Resize %{public}u %{public}u", property_->GetPersistentId(), width, height); if (IsWindowSessionInvalid()) { WLOGFE("Window session invalid."); return WMError::WM_ERROR_INVALID_WINDOW; @@ -76,7 +76,7 @@ WMError WindowExtensionSessionImpl::Resize(uint32_t width, uint32_t height) WMError WindowExtensionSessionImpl::TransferAbilityResult(uint32_t resultCode, const AAFwk::Want& want) { if (state_ < WindowState::STATE_CREATED) { - WLOGFE("Extension invalid [name:%{public}s, id:%{public}" PRIu64 "], state:%{public}u", + WLOGFE("Extension invalid [name:%{public}s, id:%{public}" PRIu32 "], state:%{public}u", property_->GetWindowName().c_str(), property_->GetPersistentId(), state_); return WMError::WM_ERROR_REPEAT_OPERATION; } @@ -86,7 +86,7 @@ WMError WindowExtensionSessionImpl::TransferAbilityResult(uint32_t resultCode, c WMError WindowExtensionSessionImpl::TransferExtensionData(const AAFwk::WantParams& wantParams) { if (state_ < WindowState::STATE_CREATED) { - WLOGFE("Extension invalid [name:%{public}s, id:%{public}" PRIu64 "], state:%{public}u", + WLOGFE("Extension invalid [name:%{public}s, id:%{public}" PRIu32 "], state:%{public}u", property_->GetWindowName().c_str(), property_->GetPersistentId(), state_); return WMError::WM_ERROR_REPEAT_OPERATION; } @@ -96,7 +96,7 @@ WMError WindowExtensionSessionImpl::TransferExtensionData(const AAFwk::WantParam void WindowExtensionSessionImpl::RegisterTransferComponentDataListener(const NotifyTransferComponentDataFunc& func) { if (state_ < WindowState::STATE_CREATED) { - WLOGFE("Extension invalid [name:%{public}s, id:%{public}" PRIu64 "], state:%{public}u", + WLOGFE("Extension invalid [name:%{public}s, id:%{public}" PRIu32 "], state:%{public}u", property_->GetWindowName().c_str(), property_->GetPersistentId(), state_); return; } diff --git a/wm/src/window_scene_session_impl.cpp b/wm/src/window_scene_session_impl.cpp index 02cc16f5e3..f26745ed3a 100644 --- a/wm/src/window_scene_session_impl.cpp +++ b/wm/src/window_scene_session_impl.cpp @@ -83,10 +83,10 @@ bool WindowSceneSessionImpl::IsValidSystemWindowType(const WindowType& type) sptr WindowSceneSessionImpl::FindParentSessionByParentId(uint32_t parentId) { for (const auto& item : windowSessionMap_) { - if (item.second.second && item.second.second->GetProperty() && - item.second.second->GetWindowId() == parentId && + if (item.second.second && item.second.second->GetProperty() && item.second.second->GetWindowId() == parentId && WindowHelper::IsMainWindow(item.second.second->GetType())) { - WLOGFD("Find parent, [parentName: %{public}s, parentId:%{public}u, selfPersistentId: %{public}" PRIu64"]", + WLOGFD("Find parent, [parentName: %{public}s, parentId:%{public}" PRIu32 + ", selfPersistentId: %{public}" PRIu32"]", item.second.second->GetProperty()->GetWindowName().c_str(), parentId, GetProperty()->GetPersistentId()); return item.second.second; } @@ -116,7 +116,7 @@ WMError WindowSceneSessionImpl::CreateAndConnectSpecificSession() return WMError::WM_ERROR_NULLPTR; } sptr eventChannel(channel); - uint64_t persistentId = INVALID_SESSION_ID; + auto persistentId = INVALID_SESSION_ID; sptr session; if (WindowHelper::IsSubWindow(GetType())) { // sub window auto parentSession = FindParentSessionByParentId(property_->GetParentId()); @@ -133,7 +133,7 @@ WMError WindowSceneSessionImpl::CreateAndConnectSpecificSession() } else { // system window if (WindowHelper::IsAppFloatingWindow(GetType())) { property_->SetParentPersistentId(GetFloatingWindowParentId()); - WLOGFI("property_ set parentPersistentId: %{public}" PRIu64 "", property_->GetParentPersistentId()); + WLOGFI("property_ set parentPersistentId: %{public}" PRIu32 "", property_->GetParentPersistentId()); } if (GetType() == WindowType::WINDOW_TYPE_DIALOG) { auto mainWindow = FindMainWindowWithContext(); @@ -153,7 +153,7 @@ WMError WindowSceneSessionImpl::CreateAndConnectSpecificSession() } else { return WMError::WM_ERROR_NULLPTR; } - WLOGFI("CreateAndConnectSpecificSession [name:%{public}s, id:%{public}" PRIu64 ", type: %{public}u]", + WLOGFI("CreateAndConnectSpecificSession [name:%{public}s, id:%{public}" PRIu32 ", type: %{public}u]", property_->GetWindowName().c_str(), property_->GetPersistentId(), GetType()); return WMError::WM_OK; } @@ -198,7 +198,7 @@ WMError WindowSceneSessionImpl::Create(const std::shared_ptrGetWindowName().c_str(), property_->GetPersistentId(), state_, windowMode_); return ret; } @@ -322,16 +322,16 @@ void WindowSceneSessionImpl::UpdateWindowSizeLimits() property_->SetWindowLimits(newLimits); } -void WindowSceneSessionImpl::UpdateSubWindowStateAndNotify(uint64_t parentPersistentId, const WindowState& newState) +void WindowSceneSessionImpl::UpdateSubWindowStateAndNotify(uint32_t parentPersistentId, const WindowState& newState) { auto iter = subWindowSessionMap_.find(parentPersistentId); if (iter == subWindowSessionMap_.end()) { - WLOGFD("main window: %{public}" PRIu64" has no child node", parentPersistentId); + WLOGFD("main window: %{public}" PRIu32" has no child node", parentPersistentId); return; } const auto& subWindows = iter->second; if (subWindows.empty()) { - WLOGFD("main window: %{public}" PRIu64", its subWindowMap is empty", parentPersistentId); + WLOGFD("main window: %{public}" PRIu32", its subWindowMap is empty", parentPersistentId); return; } @@ -356,14 +356,14 @@ void WindowSceneSessionImpl::UpdateSubWindowStateAndNotify(uint64_t parentPersis WMError WindowSceneSessionImpl::Show(uint32_t reason, bool withAnimation) { - WLOGFI("Window Show [name:%{public}s, id:%{public}" PRIu64 ", type:%{public}u], reason:%{public}u state:%{pubic}u", + WLOGFI("Window Show [name:%{public}s, id:%{public}" PRIu32 ", type:%{public}u], reason:%{public}u state:%{pubic}u", property_->GetWindowName().c_str(), property_->GetPersistentId(), GetType(), reason, state_); if (IsWindowSessionInvalid()) { WLOGFE("session is invalid"); return WMError::WM_ERROR_INVALID_WINDOW; } if (state_ == WindowState::STATE_SHOWN) { - WLOGFD("window session is alreay shown [name:%{public}s, id:%{public}" PRIu64 ", type: %{public}u]", + WLOGFD("window session is alreay shown [name:%{public}s, id:%{public}" PRIu32 ", type: %{public}u]", property_->GetWindowName().c_str(), property_->GetPersistentId(), GetType()); return WMError::WM_OK; } @@ -391,14 +391,14 @@ WMError WindowSceneSessionImpl::Show(uint32_t reason, bool withAnimation) WMError WindowSceneSessionImpl::Hide(uint32_t reason, bool withAnimation, bool isFromInnerkits) { - WLOGFI("id:%{public}" PRIu64 " Hide, reason:%{public}u, state:%{public}u", + WLOGFI("id:%{public}" PRIu32 " Hide, reason:%{public}u, state:%{public}u", property_->GetPersistentId(), reason, state_); if (IsWindowSessionInvalid()) { WLOGFE("session is invalid"); return WMError::WM_ERROR_INVALID_WINDOW; } if (state_ == WindowState::STATE_HIDDEN || state_ == WindowState::STATE_CREATED) { - WLOGFD("window session is alreay hidden [name:%{public}s, id:%{public}" PRIu64 ", type: %{public}u]", + WLOGFD("window session is alreay hidden [name:%{public}s, id:%{public}" PRIu32 ", type: %{public}u]", property_->GetWindowName().c_str(), property_->GetPersistentId(), GetType()); return WMError::WM_OK; } @@ -474,13 +474,13 @@ WSError WindowSceneSessionImpl::SetActive(bool active) void WindowSceneSessionImpl::DestroySubWindow() { for (auto elem : subWindowSessionMap_) { - WLOGFE("Id: %{public}" PRIu64 ", size: %{public}zu", elem.first, subWindowSessionMap_.size()); + WLOGFE("Id: %{public}" PRIu32 ", size: %{public}zu", elem.first, subWindowSessionMap_.size()); } - const uint64_t& parentPersistentId = property_->GetParentPersistentId(); - const uint64_t& persistentId = GetPersistentId(); + const uint32_t& parentPersistentId = property_->GetParentPersistentId(); + const uint32_t& persistentId = GetPersistentId(); - WLOGFD("Id: %{public}" PRIu64 ", parentId: %{public}" PRIu64 "", persistentId, parentPersistentId); + WLOGFD("Id: %{public}" PRIu32 ", parentId: %{public}" PRIu32 "", persistentId, parentPersistentId); // remove from subWindowMap_ when destroy sub window auto subIter = subWindowSessionMap_.find(parentPersistentId); @@ -492,7 +492,7 @@ void WindowSceneSessionImpl::DestroySubWindow() continue; } if ((*iter)->GetPersistentId() == persistentId) { - WLOGFD("Destroy sub window, persistentId: %{public}" PRIu64 "", persistentId); + WLOGFD("Destroy sub window, persistentId: %{public}" PRIu32 "", persistentId); iter = subWindows.erase(iter); break; } @@ -509,7 +509,7 @@ void WindowSceneSessionImpl::DestroySubWindow() iter = subWindows.erase(iter); continue; } - WLOGFD("Destroy sub window, persistentId: %{public}" PRIu64 "", (*iter)->GetPersistentId()); + WLOGFD("Destroy sub window, persistentId: %{public}" PRIu32 "", (*iter)->GetPersistentId()); (*iter)->Destroy(false); iter++; } @@ -520,7 +520,7 @@ void WindowSceneSessionImpl::DestroySubWindow() WMError WindowSceneSessionImpl::Destroy(bool needClearListener) { - WLOGFI("Id:%{public}" PRIu64 " Destroy, state_:%{public}u", property_->GetPersistentId(), state_); + WLOGFI("Id:%{public}" PRIu32 " Destroy, state_:%{public}u", property_->GetPersistentId(), state_); if (IsWindowSessionInvalid()) { WLOGFE("session is invalid"); return WMError::WM_OK; @@ -557,7 +557,7 @@ WMError WindowSceneSessionImpl::Destroy(bool needClearListener) WMError WindowSceneSessionImpl::MoveTo(int32_t x, int32_t y) { - WLOGFD("Id:%{public}" PRIu64 " MoveTo %{public}d %{public}d", property_->GetPersistentId(), x, y); + WLOGFD("Id:%{public}" PRIu32 " MoveTo %{public}d %{public}d", property_->GetPersistentId(), x, y); if (IsWindowSessionInvalid()) { return WMError::WM_ERROR_INVALID_WINDOW; } @@ -565,7 +565,7 @@ WMError WindowSceneSessionImpl::MoveTo(int32_t x, int32_t y) Rect newRect = { x, y, rect.width_, rect.height_ }; // must keep x/y property_->SetRequestRect(newRect); if (state_ == WindowState::STATE_HIDDEN || state_ < WindowState::STATE_CREATED) { - WLOGFD("Window is hidden or not created! id: %{public}" PRIu64 ", oriPos: [%{public}d, %{public}d, " + WLOGFD("Window is hidden or not created! id: %{public}" PRIu32 ", oriPos: [%{public}d, %{public}d, " "movePos: [%{public}d, %{public}d]", property_->GetPersistentId(), rect.posX_, rect.posY_, x, y); return WMError::WM_OK; } @@ -657,7 +657,7 @@ void WindowSceneSessionImpl::UpdateFloatingWindowSizeBySizeLimits(uint32_t& widt WMError WindowSceneSessionImpl::Resize(uint32_t width, uint32_t height) { - WLOGFD("Id:%{public}" PRIu64 " Resize %{public}u %{public}u", property_->GetPersistentId(), width, height); + WLOGFD("Id:%{public}" PRIu32 " Resize %{public}u %{public}u", property_->GetPersistentId(), width, height); if (IsWindowSessionInvalid()) { return WMError::WM_ERROR_INVALID_WINDOW; } @@ -670,7 +670,7 @@ WMError WindowSceneSessionImpl::Resize(uint32_t width, uint32_t height) Rect newRect = { rect.posX_, rect.posY_, width, height }; // must keep w/h property_->SetRequestRect(newRect); if (state_ == WindowState::STATE_HIDDEN || state_ < WindowState::STATE_CREATED) { - WLOGFD("Window is hidden or not created! id: %{public}" PRIu64 ", oriSize: [%{public}u, %{public}u, " + WLOGFD("Window is hidden or not created! id: %{public}" PRIu32 ", oriSize: [%{public}u, %{public}u, " "newSize [%{public}u, %{public}u], state: %{public}u", property_->GetPersistentId(), rect.width_, rect.height_, width, height, static_cast(state_)); return WMError::WM_OK; @@ -1442,7 +1442,7 @@ void WindowSceneSessionImpl::SetNeedDefaultAnimation(bool needDefaultAnimation) WMError WindowSceneSessionImpl::SetTransform(const Transform& trans) { - WLOGFI("property_ persistentId: %{public}" PRIu64 "", property_->GetPersistentId()); + WLOGFI("property_ persistentId: %{public}" PRIu32 "", property_->GetPersistentId()); if (IsWindowSessionInvalid()) { return WMError::WM_ERROR_INVALID_WINDOW; } @@ -1504,16 +1504,16 @@ WMError WindowSceneSessionImpl::RegisterAnimationTransitionController( // CustomAnimation is enabled when animationTransitionController_ exists animationTransitionController->AnimationForShown(); } - WLOGFI("AnimationForShown excute sucess %{public}" PRIu64"!", property->GetPersistentId()); + WLOGFI("AnimationForShown excute sucess %{public}" PRIu32"!", property->GetPersistentId()); }); } - WLOGI("RegisterAnimationTransitionController %{public}" PRIu64"!", property_->GetPersistentId()); + WLOGI("RegisterAnimationTransitionController %{public}" PRIu32"!", property_->GetPersistentId()); return WMError::WM_OK; } WMError WindowSceneSessionImpl::UpdateSurfaceNodeAfterCustomAnimation(bool isAdd) { - WLOGFI("id: %{public}" PRIu64" , isAdd:%{public}u", property_->GetPersistentId(), isAdd); + WLOGFI("id: %{public}" PRIu32" , isAdd:%{public}u", property_->GetPersistentId(), isAdd); if (IsWindowSessionInvalid()) { return WMError::WM_ERROR_INVALID_WINDOW; } @@ -1565,7 +1565,7 @@ WMError WindowSceneSessionImpl::UpdateAnimationFlagProperty(bool withAnimation) WMError WindowSceneSessionImpl::SetAlpha(float alpha) { - WLOGI("Window %{public}" PRIu64" alpha %{public}f", property_->GetPersistentId(), alpha); + WLOGI("Window %{public}" PRIu32" alpha %{public}f", property_->GetPersistentId(), alpha); if (!SessionPermission::IsSystemCalling() && !SessionPermission::IsStartByHdcd()) { WLOGFE("set alpha permission denied!"); return WMError::WM_ERROR_NOT_SYSTEM_APP; @@ -1580,7 +1580,7 @@ WMError WindowSceneSessionImpl::SetAlpha(float alpha) WMError WindowSceneSessionImpl::BindDialogTarget(sptr targetToken) { - uint32_t persistentId = property_->GetPersistentId(); + auto persistentId = property_->GetPersistentId(); WMError ret = SessionManager::GetInstance().BindDialogTarget(persistentId, targetToken); if (ret != WMError::WM_OK) { WLOGFE("bind window failed with errCode:%{public}d", static_cast(ret)); diff --git a/wm/src/window_session_impl.cpp b/wm/src/window_session_impl.cpp index 655a2674ca..d8e82c543a 100755 --- a/wm/src/window_session_impl.cpp +++ b/wm/src/window_session_impl.cpp @@ -42,15 +42,15 @@ namespace Rosen { namespace { constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowSessionImpl"}; } -std::map>> WindowSessionImpl::lifecycleListeners_; -std::map>> WindowSessionImpl::windowChangeListeners_; -std::map>> WindowSessionImpl::avoidAreaChangeListeners_; -std::map>> WindowSessionImpl::dialogDeathRecipientListeners_; -std::map>> WindowSessionImpl::dialogTargetTouchListener_; +std::map>> WindowSessionImpl::lifecycleListeners_; +std::map>> WindowSessionImpl::windowChangeListeners_; +std::map>> WindowSessionImpl::avoidAreaChangeListeners_; +std::map>> WindowSessionImpl::dialogDeathRecipientListeners_; +std::map>> WindowSessionImpl::dialogTargetTouchListener_; std::map>> WindowSessionImpl::occupiedAreaChangeListeners_; std::recursive_mutex WindowSessionImpl::globalMutex_; -std::map>> WindowSessionImpl::windowSessionMap_; -std::map>> WindowSessionImpl::subWindowSessionMap_; +std::map>> WindowSessionImpl::windowSessionMap_; +std::map>> WindowSessionImpl::subWindowSessionMap_; #define CALL_LIFECYCLE_LISTENER(windowLifecycleCb, listeners) \ do { \ @@ -121,7 +121,7 @@ RSSurfaceNode::SharedPtr WindowSessionImpl::CreateSurfaceNode(std::string name, WindowSessionImpl::~WindowSessionImpl() { - WLOGFD("~WindowSessionImpl, id: %{public}" PRIu64"", GetPersistentId()); + WLOGFD("~WindowSessionImpl, id: %{public}" PRIu32"", GetPersistentId()); Destroy(false); } @@ -140,12 +140,12 @@ bool WindowSessionImpl::IsWindowSessionInvalid() const bool res = ((hostSession_ == nullptr) || (GetPersistentId() == INVALID_SESSION_ID) || (state_ == WindowState::STATE_DESTROYED)); if (res) { - WLOGW("already destroyed or not created! id: %{public}" PRIu64" state_: %{public}u", GetPersistentId(), state_); + WLOGW("already destroyed or not created! id: %{public}" PRIu32" state_: %{public}u", GetPersistentId(), state_); } return res; } -uint64_t WindowSessionImpl::GetPersistentId() const +uint32_t WindowSessionImpl::GetPersistentId() const { if (property_) { return property_->GetPersistentId(); @@ -212,21 +212,21 @@ WMError WindowSessionImpl::Connect() } auto ret = hostSession_->Connect( iSessionStage, iWindowEventChannel, surfaceNode_, windowSystemConfig_, property_, token); - WLOGFI("Window Connect [name:%{public}s, id:%{public}" PRIu64 ", type:%{public}u], ret:%{public}u", + WLOGFI("Window Connect [name:%{public}s, id:%{public}" PRIu32 ", type:%{public}u], ret:%{public}u", property_->GetWindowName().c_str(), GetPersistentId(), property_->GetWindowType(), ret); return static_cast(ret); } WMError WindowSessionImpl::Show(uint32_t reason, bool withAnimation) { - WLOGFI("Window Show [name:%{public}s, id:%{public}" PRIu64 ", type:%{public}u], reason:%{public}u state:%{pubic}u", + WLOGFI("Window Show [name:%{public}s, id:%{public}" PRIu32 ", type:%{public}u], reason:%{public}u state:%{pubic}u", property_->GetWindowName().c_str(), GetPersistentId(), property_->GetWindowType(), reason, state_); if (IsWindowSessionInvalid()) { WLOGFE("session is invalid"); return WMError::WM_ERROR_INVALID_WINDOW; } if (state_ == WindowState::STATE_SHOWN) { - WLOGFD("window session is alreay shown [name:%{public}s, id:%{public}" PRIu64 ", type: %{public}u]", + WLOGFD("window session is alreay shown [name:%{public}s, id:%{public}" PRIu32 ", type: %{public}u]", property_->GetWindowName().c_str(), GetPersistentId(), property_->GetWindowType()); return WMError::WM_OK; } @@ -245,14 +245,14 @@ WMError WindowSessionImpl::Show(uint32_t reason, bool withAnimation) WMError WindowSessionImpl::Hide(uint32_t reason, bool withAnimation, bool isFromInnerkits) { - WLOGFI("id:%{public}" PRIu64 " Hide, reason:%{public}u, state:%{public}u", + WLOGFI("id:%{public}" PRIu32 " Hide, reason:%{public}u, state:%{public}u", GetPersistentId(), reason, state_); if (IsWindowSessionInvalid()) { WLOGFE("session is invalid"); return WMError::WM_ERROR_INVALID_WINDOW; } if (state_ == WindowState::STATE_HIDDEN || state_ == WindowState::STATE_CREATED) { - WLOGFD("window session is alreay hidden [name:%{public}s, id:%{public}" PRIu64 ", type: %{public}u]", + WLOGFD("window session is alreay hidden [name:%{public}s, id:%{public}" PRIu32 ", type: %{public}u]", property_->GetWindowName().c_str(), GetPersistentId(), property_->GetWindowType()); NotifyBackgroundFailed(WMError::WM_DO_NOTHING); return WMError::WM_OK; @@ -264,7 +264,7 @@ WMError WindowSessionImpl::Hide(uint32_t reason, bool withAnimation, bool isFrom WMError WindowSessionImpl::Destroy(bool needClearListener) { - WLOGFI("Id:%{public}" PRIu64 " Destroy, state_:%{public}u", GetPersistentId(), state_); + WLOGFI("Id:%{public}" PRIu32 " Destroy, state_:%{public}u", GetPersistentId(), state_); if (IsWindowSessionInvalid()) { WLOGFE("session is invalid"); return WMError::WM_ERROR_INVALID_WINDOW; @@ -351,11 +351,11 @@ void WindowSessionImpl::UpdateViewportConfig(const Rect& rect, WindowSizeChangeR float density = display->GetDisplayInfo()->GetVirtualPixelRatio(); config.SetDensity(density); uiContent_->UpdateViewportConfig(config, reason); - WLOGFD("Id:%{public}" PRIu64 ", windowRect:[%{public}d, %{public}d, %{public}u, %{public}u]", + WLOGFD("Id:%{public}" PRIu32 ", windowRect:[%{public}d, %{public}d, %{public}u, %{public}u]", GetPersistentId(), rect.posX_, rect.posY_, rect.width_, rect.height_); } -uint64_t WindowSessionImpl::GetFloatingWindowParentId() +uint32_t WindowSessionImpl::GetFloatingWindowParentId() { if (context_.get() == nullptr) { return INVALID_SESSION_ID; @@ -365,7 +365,7 @@ uint64_t WindowSessionImpl::GetFloatingWindowParentId() if (winPair.second.second && WindowHelper::IsMainWindow(winPair.second.second->GetType()) && winPair.second.second->GetProperty() && context_.get() == winPair.second.second->GetContext().get()) { - WLOGFD("Find parent, [parentName: %{public}s, selfPersistentId: %{public}" PRIu64"]", + WLOGFD("Find parent, [parentName: %{public}s, selfPersistentId: %{public}" PRIu32"]", winPair.second.second->GetProperty()->GetWindowName().c_str(), GetPersistentId()); return winPair.second.second->GetProperty()->GetPersistentId(); } @@ -409,7 +409,7 @@ WMError WindowSessionImpl::SetUIContent(const std::string& contentInfo, uiContent = Ace::UIContent::Create(context_.get(), engine); } if (uiContent == nullptr) { - WLOGFE("fail to SetUIContent id: %{public}" PRIu64 "", GetPersistentId()); + WLOGFE("fail to SetUIContent id: %{public}" PRIu32 "", GetPersistentId()); return WMError::WM_ERROR_NULLPTR; } if (isdistributed) { @@ -578,7 +578,7 @@ std::string WindowSessionImpl::GetContentInfo() { WLOGFD("GetContentInfo"); if (uiContent_ == nullptr) { - WLOGFE("fail to GetContentInfo id: %{public}" PRIu64 "", GetPersistentId()); + WLOGFE("fail to GetContentInfo id: %{public}" PRIu32 "", GetPersistentId()); return ""; } return uiContent_->GetContentInfo(); @@ -591,7 +591,7 @@ Ace::UIContent* WindowSessionImpl::GetUIContent() const void WindowSessionImpl::OnNewWant(const AAFwk::Want& want) { - WLOGFI("Window [name:%{public}s, id:%{public}" PRIu64 "]", + WLOGFI("Window [name:%{public}s, id:%{public}" PRIu32 "]", property_->GetWindowName().c_str(), GetPersistentId()); if (uiContent_ != nullptr) { uiContent_->OnNewWant(want); @@ -735,12 +735,12 @@ WMError WindowSessionImpl::UnregisterListener(std::vector>& holder, cons } template -void WindowSessionImpl::ClearUselessListeners(std::map& listeners, uint64_t persistentId) +void WindowSessionImpl::ClearUselessListeners(std::map& listeners, uint32_t persistentId) { listeners.erase(persistentId); } -void WindowSessionImpl::ClearListenersById(uint64_t persistentId) +void WindowSessionImpl::ClearListenersById(uint32_t persistentId) { std::lock_guard lock(globalMutex_); ClearUselessListeners(lifecycleListeners_, persistentId); @@ -945,7 +945,7 @@ WMError WindowSessionImpl::RegisterAvoidAreaChangeListener(sptr lock(globalMutex_); WMError ret = RegisterListener(avoidAreaChangeListeners_[persistentId], listener); if (ret != WMError::WM_OK) { @@ -960,7 +960,7 @@ WMError WindowSessionImpl::RegisterAvoidAreaChangeListener(sptr& listener) { WLOGFD("Start unregister"); - uint64_t persistentId = GetPersistentId(); + auto persistentId = GetPersistentId(); if (listener == nullptr) { WLOGFE("listener is nullptr"); return WMError::WM_ERROR_NULLPTR; @@ -1002,7 +1002,7 @@ void WindowSessionImpl::NotifyAvoidAreaChange(const sptr& avoidArea, WSError WindowSessionImpl::UpdateAvoidArea(const sptr& avoidArea, AvoidAreaType type) { - WLOGI("UpdateAvoidArea, id:%{public}" PRIu64, GetPersistentId()); + WLOGI("UpdateAvoidArea, id:%{public}" PRIu32, GetPersistentId()); NotifyAvoidAreaChange(avoidArea, type); return WSError::WS_OK; } diff --git a/wmserver/include/zidl/window_manager_interface.h b/wmserver/include/zidl/window_manager_interface.h index 008d3d34c1..d1195456fb 100644 --- a/wmserver/include/zidl/window_manager_interface.h +++ b/wmserver/include/zidl/window_manager_interface.h @@ -128,7 +128,7 @@ public: virtual void SetMaximizeMode(MaximizeMode maximizeMode) = 0; virtual MaximizeMode GetMaximizeMode() = 0; virtual void GetFocusWindowInfo(FocusChangeInfo& focusInfo) = 0; - virtual WSError UpdateSessionAvoidAreaListener(uint64_t& persistentId, bool haveListener) { return WSError::WS_OK; } + virtual WSError UpdateSessionAvoidAreaListener(uint32_t& persistentId, bool haveListener) { return WSError::WS_OK; } }; } } -- Gitee From 93572593d5c0a67df95a52f4979face2e6520fe3 Mon Sep 17 00:00:00 2001 From: nickyhey Date: Thu, 20 Jul 2023 09:55:31 +0800 Subject: [PATCH 3/8] code format Signed-off-by: nickyhey --- window_scene/session/host/src/scene_session.cpp | 1 - window_scene/session_manager/src/scene_session_manager.cpp | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/window_scene/session/host/src/scene_session.cpp b/window_scene/session/host/src/scene_session.cpp index cd9fc09962..7f986284e3 100644 --- a/window_scene/session/host/src/scene_session.cpp +++ b/window_scene/session/host/src/scene_session.cpp @@ -592,7 +592,6 @@ void SceneSession::NotifyIsCustomAnimatiomPlaying(bool isPlaying) if (sessionChangeCallback_ != nullptr && sessionChangeCallback_->onIsCustomAnimationPlaying_) { sessionChangeCallback_->onIsCustomAnimationPlaying_(isPlaying); } - } WSError SceneSession::UpdateWindowSceneAfterCustomAnimation(bool isAdd) diff --git a/window_scene/session_manager/src/scene_session_manager.cpp b/window_scene/session_manager/src/scene_session_manager.cpp index b5af549f8a..a44224a9fe 100644 --- a/window_scene/session_manager/src/scene_session_manager.cpp +++ b/window_scene/session_manager/src/scene_session_manager.cpp @@ -1864,9 +1864,9 @@ WMError SceneSessionManager::GetAccessibilityWindowInfo(std::vectorGetWindowName().c_str(), - sceneSession->GetSessionInfo().isSystem_, iter->first, sceneSession->GetWindowType(), - sceneSession->GetSessionState(), sceneSession->IsVisible()); + state = %{public}d, visible = %{public}d", sceneSession->GetWindowName().c_str(), + sceneSession->GetSessionInfo().isSystem_, iter->first, sceneSession->GetWindowType(), + sceneSession->GetSessionState(), sceneSession->IsVisible()); if (sceneSession->IsVisible() || sceneSession->GetSessionState() == SessionState::STATE_ACTIVE || sceneSession->GetSessionState() == SessionState::STATE_FOREGROUND) { FillWindowInfo(infos, iter->second); -- Gitee From 07a01415c3fe9a6a150a74cbba15e51284b1cc53 Mon Sep 17 00:00:00 2001 From: nickyhey Date: Thu, 20 Jul 2023 18:03:23 +0800 Subject: [PATCH 4/8] modify new conflicts in anr_****** Signed-off-by: nickyhey --- .../anr_handler/include/anr_handler.h | 8 +++---- .../framework/anr_handler/src/anr_handler.cpp | 22 +++++++++---------- .../service/event_stage/src/event_stage.cpp | 2 +- wm/include/window_session_impl.h | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/window_scene/intention_event/framework/anr_handler/include/anr_handler.h b/window_scene/intention_event/framework/anr_handler/include/anr_handler.h index 993daa580c..07c8e22048 100644 --- a/window_scene/intention_event/framework/anr_handler/include/anr_handler.h +++ b/window_scene/intention_event/framework/anr_handler/include/anr_handler.h @@ -35,20 +35,20 @@ public: void SetSessionStage(int32_t eventId, const wptr &sessionStage); void HandleEventConsumed(int32_t eventId, int64_t actionTime); - void ClearDestroyedPersistentId(uint64_t persistentId); + void ClearDestroyedPersistentId(int32_t persistentId); private: void MarkProcessed(); void SendEvent(int32_t eventId, int64_t delayTime); void SetAnrHandleState(int32_t eventId, bool status); void ClearExpiredEvents(int32_t eventId); - uint64_t GetPersistentIdOfEvent(int32_t eventId); - bool IsOnEventHandler(uint64_t persistentId); + int32_t GetPersistentIdOfEvent(int32_t eventId); + bool IsOnEventHandler(int32_t persistentId); void UpdateLatestEventId(int32_t eventId); private: std::recursive_mutex mutex_; std::shared_ptr eventHandler_ { nullptr }; struct ANRHandlerState { - std::unordered_map sendStatus; + std::unordered_map sendStatus; int32_t currentEventIdToReceipt { -1 }; std::list eventsToReceipt; }; diff --git a/window_scene/intention_event/framework/anr_handler/src/anr_handler.cpp b/window_scene/intention_event/framework/anr_handler/src/anr_handler.cpp index 264ec05392..30e2ca6fd9 100644 --- a/window_scene/intention_event/framework/anr_handler/src/anr_handler.cpp +++ b/window_scene/intention_event/framework/anr_handler/src/anr_handler.cpp @@ -31,7 +31,7 @@ constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, " constexpr int64_t MAX_MARK_PROCESS_DELAY_TIME { 3500000 }; constexpr int64_t MIN_MARK_PROCESS_DELAY_TIME { 50000 }; constexpr int32_t INVALID_EVENT_ID { -1 }; -constexpr uint64_t INVALID_PERSISTENT_ID { -1 }; +constexpr int32_t INVALID_PERSISTENT_ID { -1 }; constexpr int32_t TIME_TRANSITION { 1000 }; const std::string ANR_HANDLER_RUNNER { "ANR_HANDLER" }; } // namespace @@ -79,23 +79,23 @@ void ANRHandler::HandleEventConsumed(int32_t eventId, int64_t actionTime) } } -void ANRHandler::ClearDestroyedPersistentId(uint64_t persistentId) +void ANRHandler::ClearDestroyedPersistentId(int32_t persistentId) { CALL_DEBUG_ENTER; std::lock_guard lock(mutex_); if (anrHandlerState_.sendStatus.find(persistentId) == anrHandlerState_.sendStatus.end()) { - WLOGFE("PersistentId:%{public}" PRId64 " not in ANRHandler", persistentId); + WLOGFE("PersistentId:%{public}d not in ANRHandler", persistentId); return; } anrHandlerState_.sendStatus.erase(persistentId); - WLOGFD("PersistentId:%{public}" PRId64 " erased in ANRHandler", persistentId); + WLOGFD("PersistentId:%{public}d erased in ANRHandler", persistentId); } void ANRHandler::SetAnrHandleState(int32_t eventId, bool status) { CALL_DEBUG_ENTER; std::lock_guard lock(mutex_); - int64_t persistentId = GetPersistentIdOfEvent(eventId); + int32_t persistentId = GetPersistentIdOfEvent(eventId); anrHandlerState_.sendStatus[persistentId] = status; if (status) { anrHandlerState_.eventsToReceipt.push_back(eventId); @@ -145,9 +145,9 @@ void ANRHandler::ClearExpiredEvents(int32_t eventId) { CALL_DEBUG_ENTER; std::lock_guard lock(mutex_); - uint64_t persistentId = GetPersistentIdOfEvent(eventId); + int32_t persistentId = GetPersistentIdOfEvent(eventId); for (auto iter = sessionStageMap_.begin(); iter != sessionStageMap_.end();) { - uint64_t currentPersistentId = GetPersistentIdOfEvent(iter->first); + auto currentPersistentId = GetPersistentIdOfEvent(iter->first); if (iter->first < eventId && (currentPersistentId == persistentId || currentPersistentId == INVALID_PERSISTENT_ID)) { sessionStageMap_.erase(iter++); @@ -157,7 +157,7 @@ void ANRHandler::ClearExpiredEvents(int32_t eventId) } } -uint64_t ANRHandler::GetPersistentIdOfEvent(int32_t eventId) +int32_t ANRHandler::GetPersistentIdOfEvent(int32_t eventId) { std::lock_guard lock(mutex_); if (sessionStageMap_.find(eventId) == sessionStageMap_.end()) { @@ -172,7 +172,7 @@ uint64_t ANRHandler::GetPersistentIdOfEvent(int32_t eventId) return sessionStage->GetPersistentId(); } -bool ANRHandler::IsOnEventHandler(uint64_t persistentId) +bool ANRHandler::IsOnEventHandler(int32_t persistentId) { std::lock_guard lock(mutex_); if (anrHandlerState_.sendStatus.find(persistentId) != anrHandlerState_.sendStatus.end() && @@ -185,7 +185,7 @@ bool ANRHandler::IsOnEventHandler(uint64_t persistentId) void ANRHandler::UpdateLatestEventId(int32_t eventId) { std::lock_guard lock(mutex_); - uint64_t currentPersistentId = GetPersistentIdOfEvent(eventId); + auto currentPersistentId = GetPersistentIdOfEvent(eventId); for (auto& event : anrHandlerState_.eventsToReceipt) { if (GetPersistentIdOfEvent(event) == currentPersistentId && eventId > event) { WLOGFD("Replace eventId:%{public}d by newer eventId:%{public}d", event, eventId); @@ -195,4 +195,4 @@ void ANRHandler::UpdateLatestEventId(int32_t eventId) } } } // namespace Rosen -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/window_scene/intention_event/service/event_stage/src/event_stage.cpp b/window_scene/intention_event/service/event_stage/src/event_stage.cpp index 538ec4a259..456afe9290 100644 --- a/window_scene/intention_event/service/event_stage/src/event_stage.cpp +++ b/window_scene/intention_event/service/event_stage/src/event_stage.cpp @@ -83,7 +83,7 @@ std::list EventStage::DelEvents(int32_t persistentId, int32_t id) return timerIds; } -void EventStage::OnSessionLost(uint64_t persistentId) +void EventStage::OnSessionLost(int32_t persistentId) { CALL_DEBUG_ENTER; events_.erase(persistentId); diff --git a/wm/include/window_session_impl.h b/wm/include/window_session_impl.h index 34895f788a..4cd3af1a37 100644 --- a/wm/include/window_session_impl.h +++ b/wm/include/window_session_impl.h @@ -106,7 +106,7 @@ public: WMError SetBackgroundColor(const std::string& color) override; int32_t GetParentId() const; - int64_t GetPersistentId() const override; + int32_t GetPersistentId() const override; sptr GetProperty() const; sptr GetHostSession() const; int32_t GetFloatingWindowParentId(); -- Gitee From 57b0abda6775a3e73c70eeafe4faf021d5f32a7e Mon Sep 17 00:00:00 2001 From: nickyhey Date: Thu, 20 Jul 2023 18:49:20 +0800 Subject: [PATCH 5/8] modify NotifyFocusWindowIdEvent input para. Signed-off-by: nickyhey --- .../session/container/include/zidl/session_stage_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_scene/session/container/include/zidl/session_stage_interface.h b/window_scene/session/container/include/zidl/session_stage_interface.h index c7dfc199e1..90681e1468 100644 --- a/window_scene/session/container/include/zidl/session_stage_interface.h +++ b/window_scene/session/container/include/zidl/session_stage_interface.h @@ -47,7 +47,7 @@ public: virtual void NotifyPointerEvent(const std::shared_ptr& pointerEvent) {} virtual void NotifyKeyEvent(const std::shared_ptr& keyEvent, bool& isConsumed) {} virtual void NotifyFocusActiveEvent(bool isFocusActive) {} - virtual void NotifyFocusWindowIdEvent(uint32_t windowId) {} + virtual void NotifyFocusWindowIdEvent(int32_t windowId) {} virtual int32_t GetPersistentId() const { return -1; -- Gitee From fe6f42cd58fae7c057892d3b6f6e5c95e7e68dc1 Mon Sep 17 00:00:00 2001 From: nickyhey Date: Thu, 20 Jul 2023 21:11:40 +0800 Subject: [PATCH 6/8] solve conflicts and remove 0x7fffffff Signed-off-by: nickyhey --- window_scene/session/host/src/session.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_scene/session/host/src/session.cpp b/window_scene/session/host/src/session.cpp index 74ff1e400e..84e8eb062e 100644 --- a/window_scene/session/host/src/session.cpp +++ b/window_scene/session/host/src/session.cpp @@ -238,7 +238,7 @@ bool Session::GetVisible() const int32_t Session::GetWindowId() const { - return static_cast(GetPersistentId()) & 0x7fffffff; + return GetPersistentId(); } void Session::SetCallingPid(int32_t id) -- Gitee From 32099790c185c23d050fc7298ad35b796cf6f23d Mon Sep 17 00:00:00 2001 From: nickyhey Date: Thu, 20 Jul 2023 21:38:40 +0800 Subject: [PATCH 7/8] fix %{public}d Signed-off-by: nickyhey --- wm/src/window_scene_session_impl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wm/src/window_scene_session_impl.cpp b/wm/src/window_scene_session_impl.cpp index be9942259a..68898e005b 100644 --- a/wm/src/window_scene_session_impl.cpp +++ b/wm/src/window_scene_session_impl.cpp @@ -135,7 +135,7 @@ WMError WindowSceneSessionImpl::CreateAndConnectSpecificSession() } else { // system window if (WindowHelper::IsAppFloatingWindow(type)) { property_->SetParentPersistentId(GetFloatingWindowParentId()); - WLOGFI("property set parentPersistentId: %{public}"d, property_->GetParentPersistentId()); + WLOGFI("property set parentPersistentId: %{public}d", property_->GetParentPersistentId()); auto mainWindow = FindMainWindowWithContext(); property_->SetFloatingWindowAppType(mainWindow != nullptr ? true : false); } else if (type == WindowType::WINDOW_TYPE_DIALOG) { -- Gitee From 6680268681acd73ecb724763c091654574e3e344 Mon Sep 17 00:00:00 2001 From: nickyhey Date: Fri, 21 Jul 2023 09:15:52 +0800 Subject: [PATCH 8/8] fix conflicts Signed-off-by: nickyhey --- .../include/zidl/scene_session_manager_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/window_scene/session_manager/include/zidl/scene_session_manager_interface.h b/window_scene/session_manager/include/zidl/scene_session_manager_interface.h index c003fc0bb6..56e40527b7 100644 --- a/window_scene/session_manager/include/zidl/scene_session_manager_interface.h +++ b/window_scene/session_manager/include/zidl/scene_session_manager_interface.h @@ -79,7 +79,7 @@ public: virtual WSError GetFocusSessionToken(sptr &token) = 0; virtual WSError TerminateSessionNew(const sptr info, bool needStartCaller) = 0; virtual WSError GetSessionDumpInfo(const sptr ¶m, std::string& info) = 0; - virtual WSError GetSessionSnapshot(uint32_t persistentId, std::shared_ptr &snapshot) = 0; + virtual WSError GetSessionSnapshot(int32_t persistentId, std::shared_ptr &snapshot) = 0; // interfaces of IWindowManager WMError CreateWindow(sptr& window, sptr& property, -- Gitee