!1486 [Bug]: 修改callingWindowId传递判断

Merge pull request !1486 from 赵凌岚/master
This commit is contained in:
openharmony_ci 2024-09-20 12:32:42 +00:00 committed by Gitee
commit f4a16f9d3a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 3 additions and 12 deletions

View File

@ -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<void(uint32_t, PanelFlag)>;
InputMethodPanel() = default;
~InputMethodPanel();

View File

@ -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<InputMethodPanel> &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;
}

View File

@ -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;

View File

@ -270,12 +270,8 @@ int32_t InputMethodSystemAbility::ReleaseInput(sptr<IInputClient> client)
int32_t InputMethodSystemAbility::StartInput(InputClientInfo &inputClientInfo, sptr<IRemoteObject> &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);