From f9146c160846cb1faf7e626800b2eef9c8094352 Mon Sep 17 00:00:00 2001 From: zhaolinglan Date: Fri, 20 Sep 2024 17:37:54 +0800 Subject: [PATCH] modify setcallingwindowid Signed-off-by: zhaolinglan --- .../inputmethod_ability/include/input_method_panel.h | 1 - .../inputmethod_ability/src/input_method_ability.cpp | 5 +---- .../inputmethod_controller/include/input_method_utils.h | 1 - services/src/input_method_system_ability.cpp | 8 ++------ 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/frameworks/native/inputmethod_ability/include/input_method_panel.h b/frameworks/native/inputmethod_ability/include/input_method_panel.h index 290f383a..37b867c6 100644 --- a/frameworks/native/inputmethod_ability/include/input_method_panel.h +++ b/frameworks/native/inputmethod_ability/include/input_method_panel.h @@ -65,7 +65,6 @@ struct PanelAdjustInfo { class InputMethodPanel { public: static constexpr uint32_t INVALID_WINDOW_ID = 0; - static constexpr uint32_t ANCO_INVALID_WINDOW_ID = INVALID_WINDOW_ID - 1; using CallbackFunc = std::function; InputMethodPanel() = default; ~InputMethodPanel(); diff --git a/frameworks/native/inputmethod_ability/src/input_method_ability.cpp b/frameworks/native/inputmethod_ability/src/input_method_ability.cpp index 417c9c6c..34d34cc1 100644 --- a/frameworks/native/inputmethod_ability/src/input_method_ability.cpp +++ b/frameworks/native/inputmethod_ability/src/input_method_ability.cpp @@ -488,9 +488,6 @@ int32_t InputMethodAbility::InvokeStartInputCallback(const TextTotalConfig &text textConfig.textSelection.newBegin, textConfig.textSelection.newEnd); } } - if (textConfig.windowId == ANCO_INVALID_WINDOW_ID) { - return ErrorCode::NO_ERROR; - } auto task = [this, textConfig]() { panels_.ForEach([&textConfig](const PanelType &panelType, const std::shared_ptr &panel) { panel->SetCallingWindow(textConfig.windowId); @@ -1187,7 +1184,7 @@ int32_t InputMethodAbility::GetCallingWindowInfo(CallingWindowInfo &windowInfo) } TextTotalConfig textConfig; int32_t ret = GetTextConfig(textConfig); - if (ret != ErrorCode::NO_ERROR || textConfig.windowId == ANCO_INVALID_WINDOW_ID) { + if (ret != ErrorCode::NO_ERROR) { IMSA_HILOGE("failed to get window id, ret: %{public}d!", ret); return ErrorCode::ERROR_GET_TEXT_CONFIG; } diff --git a/frameworks/native/inputmethod_controller/include/input_method_utils.h b/frameworks/native/inputmethod_controller/include/input_method_utils.h index cadc43a6..5ebd2d0b 100644 --- a/frameworks/native/inputmethod_controller/include/input_method_utils.h +++ b/frameworks/native/inputmethod_controller/include/input_method_utils.h @@ -26,7 +26,6 @@ namespace OHOS { namespace MiscServices { constexpr uint32_t INVALID_WINDOW_ID = 0; -constexpr uint32_t ANCO_INVALID_WINDOW_ID = INVALID_WINDOW_ID - 1; constexpr int32_t INVALID_VALUE = -1; constexpr size_t MAX_PRIVATE_COMMAND_SIZE = 32 * 1024; // 32K constexpr size_t MAX_PRIVATE_COMMAND_COUNT = 5; diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index bed68a1c..50716328 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -270,12 +270,8 @@ int32_t InputMethodSystemAbility::ReleaseInput(sptr client) int32_t InputMethodSystemAbility::StartInput(InputClientInfo &inputClientInfo, sptr &agent) { AccessTokenID tokenId = IPCSkeleton::GetCallingTokenID(); - if (!identityChecker_->IsBroker(tokenId)) { - if (!identityChecker_->IsFocused(IPCSkeleton::GetCallingPid(), tokenId)) { - return ErrorCode::ERROR_CLIENT_NOT_FOCUSED; - } - } else { - inputClientInfo.config.windowId = ANCO_INVALID_WINDOW_ID; + if (!identityChecker_->IsBroker(tokenId) && !identityChecker_->IsFocused(IPCSkeleton::GetCallingPid(), tokenId)) { + return ErrorCode::ERROR_CLIENT_NOT_FOCUSED; } auto userId = GetCallingUserId(); auto session = UserSessionManager::GetInstance().GetUserSession(userId);