mirror of
https://gitee.com/openharmony/inputmethod_imf
synced 2025-03-01 11:35:58 +00:00
回退对当前客户端校验修改
Signed-off-by: cy7717 <chenyu301@huawei.com>
This commit is contained in:
parent
9bb25f58ea
commit
67dc1a6081
@ -90,7 +90,7 @@ public:
|
||||
int32_t OnStopInput(sptr<IInputClient> client);
|
||||
int32_t OnReleaseInput(sptr<IInputClient> client);
|
||||
int32_t OnSetCoreAndAgent(sptr<IInputMethodCore> core, sptr<IInputMethodAgent> agent);
|
||||
int OnHideKeyboardSelf(bool isInputClient);
|
||||
int OnHideKeyboardSelf();
|
||||
int OnShowKeyboardSelf();
|
||||
void StopInputService(std::string imeId);
|
||||
int32_t OnInputMethodSwitched(const Property &property, const SubProperty &subProperty);
|
||||
@ -140,7 +140,6 @@ private:
|
||||
void ClearImeData(uint32_t index);
|
||||
void SetCurrentClient(sptr<IInputClient> client);
|
||||
sptr<IInputClient> GetCurrentClient();
|
||||
bool IsCurrentClient(sptr<IInputClient> client);
|
||||
void SetImsCore(int32_t index, sptr<IInputMethodCore> core);
|
||||
sptr<IInputMethodCore> GetImsCore(int32_t index);
|
||||
static inline bool IsValid(int32_t index)
|
||||
|
@ -239,15 +239,13 @@ void PerUserSession::UpdateCurrentUserId(int32_t userId)
|
||||
/** Hide current keyboard
|
||||
* @param flag the flag to hide keyboard.
|
||||
*/
|
||||
int PerUserSession::OnHideKeyboardSelf(bool isInputClient)
|
||||
int PerUserSession::OnHideKeyboardSelf()
|
||||
{
|
||||
IMSA_HILOGI("PerUserSession::OnHideKeyboardSelf");
|
||||
sptr<IInputClient> client = GetCurrentClient();
|
||||
if (isInputClient) {
|
||||
if (client == nullptr || !IsCurrentClient(client)) {
|
||||
IMSA_HILOGE("current client is nullptr or verify failed");
|
||||
return ErrorCode::ERROR_CLIENT_NOT_FOUND;
|
||||
}
|
||||
if (client == nullptr) {
|
||||
IMSA_HILOGE("current client is nullptr");
|
||||
return ErrorCode::ERROR_CLIENT_NOT_FOUND;
|
||||
}
|
||||
return HideKeyboard(client);
|
||||
}
|
||||
@ -256,8 +254,8 @@ int PerUserSession::OnShowKeyboardSelf()
|
||||
{
|
||||
IMSA_HILOGD("PerUserSession::OnShowKeyboardSelf");
|
||||
sptr<IInputClient> client = GetCurrentClient();
|
||||
if (client == nullptr || !IsCurrentClient(client)) {
|
||||
IMSA_HILOGE("current client is nullptr or verify failed");
|
||||
if (client == nullptr) {
|
||||
IMSA_HILOGE("current client is nullptr");
|
||||
return ErrorCode::ERROR_CLIENT_NOT_FOUND;
|
||||
}
|
||||
return ShowKeyboard(client, true);
|
||||
@ -424,10 +422,6 @@ void PerUserSession::InitInputControlChannel()
|
||||
*/
|
||||
int32_t PerUserSession::OnStopInput(sptr<IInputClient> client)
|
||||
{
|
||||
if (GetCurrentClient() != client) {
|
||||
IMSA_HILOGE("not current client");
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
return HideKeyboard(client);
|
||||
}
|
||||
|
||||
@ -479,20 +473,6 @@ sptr<IInputClient> PerUserSession::GetCurrentClient()
|
||||
return currentClient;
|
||||
}
|
||||
|
||||
bool PerUserSession::IsCurrentClient(sptr<IInputClient> client)
|
||||
{
|
||||
if (client == nullptr) {
|
||||
return false;
|
||||
}
|
||||
auto clientInfo = GetClientInfo(client->AsObject());
|
||||
if (clientInfo == nullptr || clientInfo->pid != IPCSkeleton::GetCallingPid()
|
||||
|| clientInfo->uid != IPCSkeleton::GetCallingUid()) {
|
||||
IMSA_HILOGI("false");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int32_t PerUserSession::OnInputMethodSwitched(const Property &property, const SubProperty &subProperty)
|
||||
{
|
||||
IMSA_HILOGD("PerUserSession::OnInputMethodSwitched");
|
||||
|
Loading…
x
Reference in New Issue
Block a user