From 6c3cc9b002af4c8a3f554a10dbbea52a7e280244 Mon Sep 17 00:00:00 2001 From: c00524366 Date: Wed, 29 Sep 2021 16:56:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=BE=93=E5=85=A5=E6=B3=95?= =?UTF-8?q?=E5=BB=B6=E8=BF=9F3=E7=A7=92=E5=BC=B9=E5=87=BA?= 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/src/peruser_session.cpp | 11 +++++++++++ 3 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 31a4e059f..832d7d531 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 c2fd6ab72..5d119db48 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/src/peruser_session.cpp b/services/src/peruser_session.cpp index d9c51fe5f..555d24898 100644 --- a/services/src/peruser_session.cpp +++ b/services/src/peruser_session.cpp @@ -32,6 +32,7 @@ #include "input_control_channel_proxy.h" #include "ipc_skeleton.h" #include "input_method_core_proxy.h" +#include "unistd.h" namespace OHOS { namespace MiscServices { @@ -1324,6 +1325,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 +1395,15 @@ namespace MiscServices { } else { IMSA_HILOGI("PerUserSession::onSetInputMethodCore End...[%{public}d]\n", userId_); } + if (currentClient != nullptr) { + usleep(300000); + 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. -- Gitee