From 58c6038c68d261384dbd8cc49558df5d6b40a161 Mon Sep 17 00:00:00 2001 From: cy7717 Date: Fri, 11 Jul 2025 15:36:40 +0800 Subject: [PATCH] mod for displayid changed, panelAdjust_ not update Signed-off-by: cy7717 --- .../include/input_method_panel.h | 2 ++ .../src/input_method_panel.cpp | 20 +++++++++---------- .../src/input_method_controller.cpp | 1 + 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/frameworks/native/inputmethod_ability/include/input_method_panel.h b/frameworks/native/inputmethod_ability/include/input_method_panel.h index 093df7747..6da36bb86 100644 --- a/frameworks/native/inputmethod_ability/include/input_method_panel.h +++ b/frameworks/native/inputmethod_ability/include/input_method_panel.h @@ -179,6 +179,7 @@ private: void SetHotAreas(const HotAreas &hotAreas); HotAreas GetHotAreas(); sptr GetCurDisplay(); + uint64_t GetCurDisplayId(); void SetIgnoreAdjustInputTypes(const std::vector &inputTypes); std::vector GetIgnoreAdjustInputTypes(); bool IsNeedConfig(); @@ -210,6 +211,7 @@ private: std::mutex panelAdjustLock_; std::map, PanelAdjustInfo> panelAdjust_; std::mutex adjustInfoInitLock_; + uint64_t panelAdjustDisplayId_ = 0; std::atomic isAdjustInfoInitialized_{ false }; std::atomic isIgnorePanelAdjustInitialized_{ false }; std::mutex ignoreAdjustInputTypeLock_; diff --git a/frameworks/native/inputmethod_ability/src/input_method_panel.cpp b/frameworks/native/inputmethod_ability/src/input_method_panel.cpp index 0bf9e8c45..b11de99ae 100644 --- a/frameworks/native/inputmethod_ability/src/input_method_panel.cpp +++ b/frameworks/native/inputmethod_ability/src/input_method_panel.cpp @@ -1017,16 +1017,15 @@ int32_t InputMethodPanel::UpdateRegion(std::vector region) int32_t InputMethodPanel::InitAdjustInfo() { - if (isAdjustInfoInitialized_.load()) { - return ErrorCode::NO_ERROR; - } std::lock_guard initLk(adjustInfoInitLock_); - if (isAdjustInfoInitialized_.load()) { + auto curDisplayId = GetCurDisplayId(); + if (isAdjustInfoInitialized_.load() && panelAdjustDisplayId_ == curDisplayId) { return ErrorCode::NO_ERROR; } std::vector configs; auto isSuccess = SysCfgParser::ParsePanelAdjust(configs); if (!isSuccess) { + panelAdjustDisplayId_ = curDisplayId; isAdjustInfoInitialized_.store(true); return ErrorCode::NO_ERROR; } @@ -1045,6 +1044,7 @@ int32_t InputMethodPanel::InitAdjustInfo() .bottom = static_cast(config.bottom * densityDpi) }; panelAdjust_.insert({ config.style, info }); } + panelAdjustDisplayId_ = curDisplayId; isAdjustInfoInitialized_.store(true); return ErrorCode::NO_ERROR; } @@ -2253,15 +2253,15 @@ sptr InputMethodPanel::GetCurDisplay() return displayInfo; } +uint64_t InputMethodPanel::GetCurDisplayId() +{ + return InputMethodAbility::GetInstance().GetInputAttribute().callingDisplayId; +} + bool InputMethodPanel::IsInMainDisplay() { IMSA_HILOGD("enter!!"); - uint64_t displayId = 0; - auto ret = GetDisplayId(displayId); - if (ret != ErrorCode::NO_ERROR) { - IMSA_HILOGE("GetDisplayId err:%{public}d!", ret); - return true; - } + uint64_t displayId = GetCurDisplayId(); auto primaryDisplay = Rosen::DisplayManager::GetInstance().GetPrimaryDisplaySync(); if (primaryDisplay == nullptr) { IMSA_HILOGE("primaryDisplay failed!"); diff --git a/frameworks/native/inputmethod_controller/src/input_method_controller.cpp b/frameworks/native/inputmethod_controller/src/input_method_controller.cpp index e129c4d6a..0946abc7e 100644 --- a/frameworks/native/inputmethod_controller/src/input_method_controller.cpp +++ b/frameworks/native/inputmethod_controller/src/input_method_controller.cpp @@ -341,6 +341,7 @@ int32_t InputMethodController::Attach(sptr listener, cons .SetClientType(type) .Build(); ImcHiSysEventReporter::GetInstance().ReportEvent(ImfEventType::CLIENT_ATTACH, *evenInfo); + TCLODE() return ret; } clientInfo_.state = ClientState::ACTIVE; -- Gitee