Signed-off-by: htt1997 <hutao105@huawei.com>
This commit is contained in:
htt1997 2024-08-19 10:08:24 +08:00
parent a63e339066
commit f4bccbf0ce
2 changed files with 13 additions and 1 deletions

View File

@ -164,6 +164,16 @@ sptr<IInputMethodSystemAbility> InputMethodController::GetSystemAbilityProxy()
return abilityManager_;
}
void InputMethodController::RemoveDeathRecipient()
{
std::lock_guard<std::mutex> lock(abilityLock_);
if (abilityManager_ == nullptr || deathRecipient_ == nullptr) {
return;
}
abilityManager_->AsObject()->RemoveDeathRecipient(deathRecipient_);
deathRecipient_ = nullptr;
}
void InputMethodController::DeactivateClient()
{
{
@ -461,6 +471,8 @@ int32_t InputMethodController::ReleaseInput(sptr<IInputClient> &client)
if (ret == ErrorCode::NO_ERROR) {
OnInputStop();
}
RemoveDeathRecipient();
SetTextListener(nullptr);
return ret;
}
@ -916,7 +928,6 @@ void InputMethodController::OnInputStop()
}
listener->SendKeyboardStatus(KeyboardStatus::HIDE);
}
SetTextListener(nullptr);
isBound_.store(false);
isEditable_.store(false);
}

View File

@ -770,6 +770,7 @@ private:
int32_t Initialize();
sptr<IInputMethodSystemAbility> GetSystemAbilityProxy();
void RemoveDeathRecipient();
int32_t StartInput(InputClientInfo &inputClientInfo, sptr<IRemoteObject> &agent);
int32_t ShowInput(sptr<IInputClient> &client);
int32_t HideInput(sptr<IInputClient> &client);