diff --git a/frameworks/inputmethod_controller/include/input_method_controller.h b/frameworks/inputmethod_controller/include/input_method_controller.h index 84f9902..f1ec5d6 100644 --- a/frameworks/inputmethod_controller/include/input_method_controller.h +++ b/frameworks/inputmethod_controller/include/input_method_controller.h @@ -47,8 +47,8 @@ namespace MiscServices { class InputMethodController : public RefBase { public: static sptr GetInstance(); - void Attach(); - void ShowTextInput(sptr &listener); + void Attach(sptr &listener); + void ShowTextInput(); void HideTextInput(); void Close(); void OnRemoteSaDied(const wptr &object); diff --git a/frameworks/inputmethod_controller/src/input_method_controller.cpp b/frameworks/inputmethod_controller/src/input_method_controller.cpp index f695006..5e926d3 100644 --- a/frameworks/inputmethod_controller/src/input_method_controller.cpp +++ b/frameworks/inputmethod_controller/src/input_method_controller.cpp @@ -156,15 +156,15 @@ using namespace MessageID; } } - void InputMethodController::Attach() + void InputMethodController::Attach(sptr &listener) { PrepareInput(0, mClient, mInputDataChannel, mAttribute); + textListener=listener; } - void InputMethodController::ShowTextInput(sptr &listener) + void InputMethodController::ShowTextInput() { IMSA_HILOGI("InputMethodController::ShowTextInput"); - textListener = listener; StartInput(mClient); } diff --git a/services/include/peruser_session.h b/services/include/peruser_session.h index edfb3b8..77fdbb5 100644 --- a/services/include/peruser_session.h +++ b/services/include/peruser_session.h @@ -124,6 +124,7 @@ namespace MiscServices { int MIN_IME = 2; int IME_ERROR_CODE = 3; int COMMON_COUNT_THREE_HUNDRED = 300; + int SLEEP_TIME = 300000; InputMethodProperty *currentIme[MAX_IME]; // 0 - the default ime. 1 - security ime diff --git a/services/src/peruser_session.cpp b/services/src/peruser_session.cpp index 8430fbc..7884b3c 100644 --- a/services/src/peruser_session.cpp +++ b/services/src/peruser_session.cpp @@ -1305,6 +1305,15 @@ namespace MiscServices { } else { IMSA_HILOGI("PerUserSession::onSetInputMethodCore End...[%{public}d]\n", userId_); } + if (currentClient != nullptr) { + usleep(SLEEP_TIME); + ret = ShowKeyboard(currentClient); + if (ret != ErrorCode::NO_ERROR) { + IMSA_HILOGE("PerUserSession::OnStartInput Aborted! %{public}s", ErrorCode::ToString(ret)); + } else { + IMSA_HILOGI("PerUserSession::OnStartInput End...[%{public}d]\n", userId_); + } + } } /*! Stop input. Called by an input client. diff --git a/unitest/src/input_method_controller_test.cpp b/unitest/src/input_method_controller_test.cpp index dc95211..4a41ce7 100644 --- a/unitest/src/input_method_controller_test.cpp +++ b/unitest/src/input_method_controller_test.cpp @@ -198,12 +198,12 @@ namespace MiscServices { sptr textListener = new TextListener(); IMSA_HILOGI("IMC Attach START"); - imc->Attach(); + imc->Attach(textListener); int waitForStatusOk = 2; sleep(waitForStatusOk); IMSA_HILOGI("IMC ShowTextInput START"); - imc->ShowTextInput(textListener); + imc->ShowTextInput(); sleep(10); IMSA_HILOGI("IMC HideTextInput START");