From 8d468a435134970a65a8074e18a2539faf699e41 Mon Sep 17 00:00:00 2001 From: c00524366 Date: Wed, 29 Sep 2021 17:49:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=BB=B6=E8=BF=9F3=E7=A7=92?= =?UTF-8?q?=E5=BC=B9=E8=B5=B7=E8=BE=93=E5=85=A5=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: c00524366 --- .../include/input_method_controller.h | 4 ++-- .../src/input_method_controller.cpp | 6 +++--- services/include/peruser_session.h | 1 + services/src/peruser_session.cpp | 10 ++++++++++ 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/frameworks/inputmethod_controller/include/input_method_controller.h b/frameworks/inputmethod_controller/include/input_method_controller.h index 31a4e05..832d7d5 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 c2fd6ab..5d119db 100644 --- a/frameworks/inputmethod_controller/src/input_method_controller.cpp +++ b/frameworks/inputmethod_controller/src/input_method_controller.cpp @@ -151,15 +151,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 6efcef1..8c01f39 100644 --- a/services/include/peruser_session.h +++ b/services/include/peruser_session.h @@ -146,6 +146,7 @@ namespace MiscServices { std::mutex mtx; // mutex to lock the operations among multi work threads sptr connCallback; sptr inputMethodAbility_; + int SLEEP_TIME = 300000; PerUserSession(const PerUserSession&); PerUserSession& operator= (const PerUserSession&); diff --git a/services/src/peruser_session.cpp b/services/src/peruser_session.cpp index d9c51fe..64e8d55 100644 --- a/services/src/peruser_session.cpp +++ b/services/src/peruser_session.cpp @@ -1324,6 +1324,7 @@ namespace MiscServices { IMSA_HILOGI("PerUserSession::OnPrepareInput BindInputAbility start"); BindInputAbility(); IMSA_HILOGI("PerUserSession::OnPrepareInput BindInputAbility end"); + currentClient = client; } /*! Release input. Called by an input client. @@ -1393,6 +1394,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.