解决没有绑定输入法时,还消费物理按键的问题

Signed-off-by: zhouyongfei <zhouyongfei@huawei.com>
This commit is contained in:
zhouyongfei
2022-02-14 17:07:40 +08:00
parent e5a81d3536
commit 7466ee37e9
8 changed files with 52 additions and 1 deletions
@@ -138,6 +138,11 @@ namespace MiscServices {
OnInitInputControlChannel(msg);
break;
}
case MSG_ID_SET_CLIENT_STATE: {
MessageParcel *data = msg->msgContent_;
isBindClient = data->ReadBool();
break;
}
case MSG_ID_START_INPUT: {
OnStartInput(msg);
break;
@@ -252,6 +257,10 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodAbility::DispatchKeyEvent");
IMSA_HILOGI("InputMethodAbility::DispatchKeyEvent: key = %{public}d, status = %{public}d", keyCode, keyStatus);
if (!isBindClient) {
IMSA_HILOGI("InputMethodAbility::DispatchKeyEvent abort. no client");
return false;
}
return imeListener_->OnKeyEvent(keyCode, keyStatus);
}