diff --git a/frameworks/inputmethod_controller/include/input_method_controller.h b/frameworks/inputmethod_controller/include/input_method_controller.h index 99af3ca..daeaf44 100644 --- a/frameworks/inputmethod_controller/include/input_method_controller.h +++ b/frameworks/inputmethod_controller/include/input_method_controller.h @@ -111,6 +111,8 @@ namespace MiscServices { bool stop_; int32_t enterKeyType_ = 0; int32_t inputPattern_ = 0; + + bool isStopInput {false}; }; } // namespace MiscServices } // namespace OHOS diff --git a/frameworks/inputmethod_controller/src/input_method_controller.cpp b/frameworks/inputmethod_controller/src/input_method_controller.cpp index 02f525a..044cd8a 100644 --- a/frameworks/inputmethod_controller/src/input_method_controller.cpp +++ b/frameworks/inputmethod_controller/src/input_method_controller.cpp @@ -294,6 +294,7 @@ using namespace MessageID; && data.WriteRemoteObject(client->AsObject()))) { return; } + isStopInput = false; mImms->startInput(data); } @@ -308,6 +309,7 @@ using namespace MessageID; && data.WriteRemoteObject(client->AsObject().GetRefPtr()))) { return; } + isStopInput = true; mImms->releaseInput(data); } @@ -322,6 +324,7 @@ using namespace MessageID; && data.WriteRemoteObject(client->AsObject().GetRefPtr()))) { return; } + isStopInput = true; mImms->stopInput(data); } @@ -347,6 +350,11 @@ using namespace MessageID; return; } + if (isStopInput == true) { + IMSA_HILOGD("InputMethodController::OnCursorUpdate isStopInput is true"); + return; + } + if (cursorInfo_.left == cursorInfo.left && cursorInfo_.top == cursorInfo.top && cursorInfo_.height == cursorInfo.height) { return; @@ -371,6 +379,12 @@ using namespace MessageID; IMSA_HILOGI("InputMethodController::OnSelectionChange agent is nullptr"); return; } + + if (isStopInput == true) { + IMSA_HILOGD("InputMethodController::OnSelectionChange isStopInput is true"); + return; + } + agent->OnSelectionChange(mTextString, mSelectOldBegin, mSelectOldEnd, mSelectNewBegin, mSelectNewEnd); } @@ -411,6 +425,12 @@ using namespace MessageID; IMSA_HILOGI("InputMethodController::dispatchKeyEvent agent is nullptr"); return false; } + + if (isStopInput == true) { + IMSA_HILOGD("InputMethodController::dispatchKeyEvent isStopInput is true"); + return false; + } + MessageParcel data; if (!(data.WriteInterfaceToken(agent->GetDescriptor()) && data.WriteInt32(keyEvent->GetKeyCode()) @@ -441,6 +461,12 @@ using namespace MessageID; IMSA_HILOGI("InputMethodController::SetCallingWindow agent is nullptr"); return; } + + if (isStopInput == true) { + IMSA_HILOGD("InputMethodController::SetCallingWindow isStopInput is true"); + return; + } + agent->SetCallingWindow(windowId); }