mirror of
https://gitee.com/openharmony/inputmethod_imf
synced 2024-11-30 10:20:49 +00:00
add Show and Hide keyboard
Signed-off-by: zhaolinglan <zhaolinglan@huawei.com>
This commit is contained in:
parent
1854f3388d
commit
3add5b6a1b
2
BUILD.gn
2
BUILD.gn
@ -24,7 +24,7 @@ group("imf_packages") {
|
|||||||
"frameworks/inputmethod_ability:inputmethod_ability",
|
"frameworks/inputmethod_ability:inputmethod_ability",
|
||||||
"frameworks/inputmethod_controller:inputmethod_client",
|
"frameworks/inputmethod_controller:inputmethod_client",
|
||||||
"interfaces/kits/js/declaration:inputmethod",
|
"interfaces/kits/js/declaration:inputmethod",
|
||||||
"interfaces/kits/js/napi/inputmethod:inputmethod",
|
"interfaces/kits/js/napi/inputmethodclient:inputmethod",
|
||||||
"interfaces/kits/js/napi/inputmethodengine:inputmethodengine",
|
"interfaces/kits/js/napi/inputmethodengine:inputmethodengine",
|
||||||
"profile:inputmethod_inputmethod_sa_profiles",
|
"profile:inputmethod_inputmethod_sa_profiles",
|
||||||
"services:inputmethod_service",
|
"services:inputmethod_service",
|
||||||
|
14
bundle.json
14
bundle.json
@ -57,7 +57,7 @@
|
|||||||
"//base/inputmethod/imf/frameworks/kits/extension:inputmethod_extension",
|
"//base/inputmethod/imf/frameworks/kits/extension:inputmethod_extension",
|
||||||
"//base/inputmethod/imf/frameworks/kits/extension:inputmethod_extension_module",
|
"//base/inputmethod/imf/frameworks/kits/extension:inputmethod_extension_module",
|
||||||
"//base/inputmethod/imf/interfaces/kits/js/declaration:inputmethod",
|
"//base/inputmethod/imf/interfaces/kits/js/declaration:inputmethod",
|
||||||
"//base/inputmethod/imf/interfaces/kits/js/napi/inputmethod:inputmethod",
|
"//base/inputmethod/imf/interfaces/kits/js/napi/inputmethodclient:inputmethod",
|
||||||
"//base/inputmethod/imf/interfaces/kits/js/napi/inputmethodengine:inputmethodengine",
|
"//base/inputmethod/imf/interfaces/kits/js/napi/inputmethodengine:inputmethodengine",
|
||||||
"//base/inputmethod/imf/interfaces/kits/js/napi/inputmethod_extension_ability:inputmethodextensionability_napi",
|
"//base/inputmethod/imf/interfaces/kits/js/napi/inputmethod_extension_ability:inputmethodextensionability_napi",
|
||||||
"//base/inputmethod/imf/interfaces/kits/js/napi/inputmethod_extension_context:inputmethodextensioncontext_napi",
|
"//base/inputmethod/imf/interfaces/kits/js/napi/inputmethod_extension_context:inputmethodextensioncontext_napi",
|
||||||
@ -105,15 +105,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "//base/inputmethod/imf/interfaces/kits/js/napi/inputmethod:inputmethod",
|
"name": "//base/inputmethod/imf/interfaces/kits/js/napi/inputmethodclient:inputmethod",
|
||||||
"header": {
|
"header": {
|
||||||
"header_files": [
|
"header_files": [
|
||||||
"js_input_method_registry.h",
|
"async_call.h",
|
||||||
"js_input_method_utils.h",
|
"js_get_input_method_controller.h",
|
||||||
"js_input_method_setting.h",
|
"js_get_input_method_setting.h",
|
||||||
"js_input_method_controller.h"
|
"js_input_method.h"
|
||||||
],
|
],
|
||||||
"header_base": "//base/inputmethod/imf/interfaces/kits/js/napi/inputmethod/include"
|
"header_base": "//base/inputmethod/imf/interfaces/kits/js/napi/inputmethodclient"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ namespace MiscServices {
|
|||||||
const InputAttribute& editorAttribute,
|
const InputAttribute& editorAttribute,
|
||||||
bool supportPhysicalKbd) = 0;
|
bool supportPhysicalKbd) = 0;
|
||||||
virtual int32_t stopInput() = 0;
|
virtual int32_t stopInput() = 0;
|
||||||
virtual bool showKeyboard(const sptr<IInputDataChannel>& inputDataChannel) = 0;
|
virtual bool showKeyboard(const sptr<IInputDataChannel>& inputDataChannel, bool isShowKeyboard) = 0;
|
||||||
virtual bool hideKeyboard(int32_t flags) = 0;
|
virtual bool hideKeyboard(int32_t flags) = 0;
|
||||||
virtual int32_t setKeyboardType(const KeyboardType& type) = 0;
|
virtual int32_t setKeyboardType(const KeyboardType& type) = 0;
|
||||||
virtual int32_t getKeyboardWindowHeight(int32_t &retHeight) = 0;
|
virtual int32_t getKeyboardWindowHeight(int32_t &retHeight) = 0;
|
||||||
|
@ -40,7 +40,7 @@ namespace MiscServices {
|
|||||||
const InputAttribute& editorAttribute,
|
const InputAttribute& editorAttribute,
|
||||||
bool supportPhysicalKbd) override;
|
bool supportPhysicalKbd) override;
|
||||||
int32_t stopInput() override;
|
int32_t stopInput() override;
|
||||||
bool showKeyboard(const sptr<IInputDataChannel>& inputDataChannel) override;
|
bool showKeyboard(const sptr<IInputDataChannel>& inputDataChannel, bool isShowKeyboard) override;
|
||||||
bool hideKeyboard(int32_t flags) override;
|
bool hideKeyboard(int32_t flags) override;
|
||||||
int32_t setKeyboardType(const KeyboardType& type) override;
|
int32_t setKeyboardType(const KeyboardType& type) override;
|
||||||
int32_t getKeyboardWindowHeight(int32_t &retHeight) override;
|
int32_t getKeyboardWindowHeight(int32_t &retHeight) override;
|
||||||
|
@ -49,7 +49,7 @@ namespace MiscServices {
|
|||||||
const InputAttribute& editorAttribute,
|
const InputAttribute& editorAttribute,
|
||||||
bool supportPhysicalKbd) override;
|
bool supportPhysicalKbd) override;
|
||||||
int32_t stopInput() override;
|
int32_t stopInput() override;
|
||||||
bool showKeyboard(const sptr<IInputDataChannel>& inputDataChannel) override;
|
bool showKeyboard(const sptr<IInputDataChannel>& inputDataChannel, bool isWindowShow) override;
|
||||||
bool hideKeyboard(int32_t flags)override;
|
bool hideKeyboard(int32_t flags)override;
|
||||||
int32_t setKeyboardType(const KeyboardType& type) override;
|
int32_t setKeyboardType(const KeyboardType& type) override;
|
||||||
int32_t getKeyboardWindowHeight(int32_t &retHeight) override;
|
int32_t getKeyboardWindowHeight(int32_t &retHeight) override;
|
||||||
|
@ -243,7 +243,10 @@ namespace MiscServices {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SetInputDataChannel(channelObject);
|
SetInputDataChannel(channelObject);
|
||||||
ShowInputWindow();
|
bool isShowKeyboard = data->ReadBool();
|
||||||
|
if (isShowKeyboard) {
|
||||||
|
ShowInputWindow();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputMethodAbility::OnHideKeyboard(Message *msg)
|
void InputMethodAbility::OnHideKeyboard(Message *msg)
|
||||||
@ -328,7 +331,6 @@ namespace MiscServices {
|
|||||||
IMSA_HILOGI("InputMethodAbility::ShowInputWindow imeListener_ is nullptr");
|
IMSA_HILOGI("InputMethodAbility::ShowInputWindow imeListener_ is nullptr");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
imeListener_->OnInputStart();
|
|
||||||
imeListener_->OnKeyboardStatus(true);
|
imeListener_->OnKeyboardStatus(true);
|
||||||
std::shared_ptr<InputDataChannelProxy> channel = GetInputDataChannel();
|
std::shared_ptr<InputDataChannelProxy> channel = GetInputDataChannel();
|
||||||
if (channel == nullptr) {
|
if (channel == nullptr) {
|
||||||
|
@ -193,7 +193,7 @@ namespace MiscServices {
|
|||||||
return reply.ReadInt32();
|
return reply.ReadInt32();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputMethodCoreProxy::showKeyboard(const sptr<IInputDataChannel> &inputDataChannel)
|
bool InputMethodCoreProxy::showKeyboard(const sptr<IInputDataChannel> &inputDataChannel, bool isShowKeyboard)
|
||||||
{
|
{
|
||||||
IMSA_HILOGI("InputMethodCoreProxy::showKeyboard");
|
IMSA_HILOGI("InputMethodCoreProxy::showKeyboard");
|
||||||
auto remote = Remote();
|
auto remote = Remote();
|
||||||
@ -203,14 +203,12 @@ namespace MiscServices {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MessageParcel data;
|
MessageParcel data;
|
||||||
if (!(data.WriteInterfaceToken(GetDescriptor())
|
if (!(data.WriteInterfaceToken(GetDescriptor()) && data.WriteRemoteObject(inputDataChannel->AsObject())
|
||||||
&& data.WriteRemoteObject(inputDataChannel->AsObject()))) {
|
&& data.WriteBool(isShowKeyboard))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MessageParcel reply;
|
MessageParcel reply;
|
||||||
MessageOption option {
|
MessageOption option{ MessageOption::TF_SYNC };
|
||||||
MessageOption::TF_SYNC
|
|
||||||
};
|
|
||||||
|
|
||||||
int32_t res = remote->SendRequest(SHOW_KEYBOARD, data, reply, option);
|
int32_t res = remote->SendRequest(SHOW_KEYBOARD, data, reply, option);
|
||||||
if (res != ErrorCode::NO_ERROR) {
|
if (res != ErrorCode::NO_ERROR) {
|
||||||
|
@ -110,7 +110,8 @@ namespace MiscServices {
|
|||||||
}
|
}
|
||||||
case SHOW_KEYBOARD: {
|
case SHOW_KEYBOARD: {
|
||||||
sptr<IInputDataChannel> inputDataChannel = iface_cast<IInputDataChannel>(data.ReadRemoteObject());
|
sptr<IInputDataChannel> inputDataChannel = iface_cast<IInputDataChannel>(data.ReadRemoteObject());
|
||||||
showKeyboard(inputDataChannel);
|
bool isShowKeyboard = data.ReadBool();
|
||||||
|
showKeyboard(inputDataChannel, isShowKeyboard);
|
||||||
reply.WriteNoException();
|
reply.WriteNoException();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -230,7 +231,7 @@ namespace MiscServices {
|
|||||||
msgHandler_->SendMessage(msg);
|
msgHandler_->SendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InputMethodCoreStub::showKeyboard(const sptr<IInputDataChannel>& inputDataChannel)
|
bool InputMethodCoreStub::showKeyboard(const sptr<IInputDataChannel>& inputDataChannel, bool isShowKeyboard)
|
||||||
{
|
{
|
||||||
IMSA_HILOGI("InputMethodCoreStub::showKeyboard");
|
IMSA_HILOGI("InputMethodCoreStub::showKeyboard");
|
||||||
if (!msgHandler_) {
|
if (!msgHandler_) {
|
||||||
@ -240,6 +241,7 @@ namespace MiscServices {
|
|||||||
if (inputDataChannel) {
|
if (inputDataChannel) {
|
||||||
IMSA_HILOGI("InputMethodCoreStub::showKeyboard inputDataChannel is not nullptr");
|
IMSA_HILOGI("InputMethodCoreStub::showKeyboard inputDataChannel is not nullptr");
|
||||||
data->WriteRemoteObject(inputDataChannel->AsObject());
|
data->WriteRemoteObject(inputDataChannel->AsObject());
|
||||||
|
data->WriteBool(isShowKeyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
Message *msg = new Message(MessageID::MSG_ID_SHOW_KEYBOARD, data);
|
Message *msg = new Message(MessageID::MSG_ID_SHOW_KEYBOARD, data);
|
||||||
|
@ -58,7 +58,7 @@ namespace MiscServices {
|
|||||||
class InputMethodController : public RefBase {
|
class InputMethodController : public RefBase {
|
||||||
public:
|
public:
|
||||||
static sptr<InputMethodController> GetInstance();
|
static sptr<InputMethodController> GetInstance();
|
||||||
void Attach(sptr<OnTextChangedListener> &listener);
|
void Attach(sptr<OnTextChangedListener> &listener, bool isShowKeyboard = true);
|
||||||
std::u16string GetTextBeforeCursor(int32_t number);
|
std::u16string GetTextBeforeCursor(int32_t number);
|
||||||
std::u16string GetTextAfterCursor(int32_t number);
|
std::u16string GetTextAfterCursor(int32_t number);
|
||||||
void ShowTextInput();
|
void ShowTextInput();
|
||||||
@ -74,6 +74,7 @@ namespace MiscServices {
|
|||||||
int32_t GetEnterKeyType();
|
int32_t GetEnterKeyType();
|
||||||
int32_t GetInputPattern();
|
int32_t GetInputPattern();
|
||||||
int32_t HideCurrentInput();
|
int32_t HideCurrentInput();
|
||||||
|
int32_t ShowCurrentInput();
|
||||||
void SetCallingWindow(uint32_t windowId);
|
void SetCallingWindow(uint32_t windowId);
|
||||||
int32_t SwitchInputMethod(const InputMethodProperty &target);
|
int32_t SwitchInputMethod(const InputMethodProperty &target);
|
||||||
|
|
||||||
@ -85,7 +86,7 @@ namespace MiscServices {
|
|||||||
sptr<InputMethodSystemAbilityProxy> GetImsaProxy();
|
sptr<InputMethodSystemAbilityProxy> GetImsaProxy();
|
||||||
void PrepareInput(int32_t displayId, sptr<InputClientStub> &client, sptr<InputDataChannelStub> &channel,
|
void PrepareInput(int32_t displayId, sptr<InputClientStub> &client, sptr<InputDataChannelStub> &channel,
|
||||||
InputAttribute &attribute);
|
InputAttribute &attribute);
|
||||||
void StartInput(sptr<InputClientStub> &client);
|
void StartInput(sptr<InputClientStub> &client, bool isShowKeyboard);
|
||||||
void StopInput(sptr<InputClientStub> &client);
|
void StopInput(sptr<InputClientStub> &client);
|
||||||
void ReleaseInput(sptr<InputClientStub> &client);
|
void ReleaseInput(sptr<InputClientStub> &client);
|
||||||
void SetInputMethodAgent(sptr<IRemoteObject> &object);
|
void SetInputMethodAgent(sptr<IRemoteObject> &object);
|
||||||
|
@ -50,6 +50,7 @@ namespace MiscServices {
|
|||||||
void stopInput(MessageParcel& data) override;
|
void stopInput(MessageParcel& data) override;
|
||||||
void SetCoreAndAgent(MessageParcel& data) override;
|
void SetCoreAndAgent(MessageParcel& data) override;
|
||||||
int32_t HideCurrentInput(MessageParcel& data) override;
|
int32_t HideCurrentInput(MessageParcel& data) override;
|
||||||
|
int32_t ShowCurrentInput(MessageParcel& data) override;
|
||||||
|
|
||||||
int32_t Prepare(int32_t displayId, sptr<InputClientStub> &client, sptr<InputDataChannelStub> &channel,
|
int32_t Prepare(int32_t displayId, sptr<InputClientStub> &client, sptr<InputDataChannelStub> &channel,
|
||||||
InputAttribute &attribute);
|
InputAttribute &attribute);
|
||||||
|
@ -199,19 +199,19 @@ using namespace MessageID;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputMethodController::Attach(sptr<OnTextChangedListener> &listener)
|
void InputMethodController::Attach(sptr<OnTextChangedListener> &listener, bool isShowKeyboard)
|
||||||
{
|
{
|
||||||
textListener = listener;
|
textListener = listener;
|
||||||
IMSA_HILOGI("InputMethodController::Attach");
|
IMSA_HILOGI("InputMethodController::Attach");
|
||||||
InputmethodTrace tracer("InputMethodController Attach trace.");
|
InputmethodTrace tracer("InputMethodController Attach trace.");
|
||||||
StartInput(mClient);
|
StartInput(mClient, isShowKeyboard);
|
||||||
PrepareInput(0, mClient, mInputDataChannel, mAttribute);
|
PrepareInput(0, mClient, mInputDataChannel, mAttribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputMethodController::ShowTextInput()
|
void InputMethodController::ShowTextInput()
|
||||||
{
|
{
|
||||||
IMSA_HILOGI("InputMethodController::ShowTextInput");
|
IMSA_HILOGI("InputMethodController::ShowTextInput");
|
||||||
StartInput(mClient);
|
StartInput(mClient, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputMethodController::HideTextInput()
|
void InputMethodController::HideTextInput()
|
||||||
@ -233,6 +233,19 @@ using namespace MessageID;
|
|||||||
return mImms->HideCurrentInput(data);
|
return mImms->HideCurrentInput(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t InputMethodController::ShowCurrentInput()
|
||||||
|
{
|
||||||
|
IMSA_HILOGI("InputMethodController::ShowCurrentInput");
|
||||||
|
if (!mImms) {
|
||||||
|
return ErrorCode::ERROR_KBD_SHOW_FAILED;
|
||||||
|
}
|
||||||
|
MessageParcel data;
|
||||||
|
if (!(data.WriteInterfaceToken(mImms->GetDescriptor()))) {
|
||||||
|
return ErrorCode::ERROR_KBD_SHOW_FAILED;
|
||||||
|
}
|
||||||
|
return mImms->ShowCurrentInput(data);
|
||||||
|
}
|
||||||
|
|
||||||
void InputMethodController::Close()
|
void InputMethodController::Close()
|
||||||
{
|
{
|
||||||
ReleaseInput(mClient);
|
ReleaseInput(mClient);
|
||||||
@ -283,15 +296,15 @@ using namespace MessageID;
|
|||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputMethodController::StartInput(sptr<InputClientStub> &client)
|
void InputMethodController::StartInput(sptr<InputClientStub> &client, bool isShowKeyboard)
|
||||||
{
|
{
|
||||||
IMSA_HILOGI("InputMethodController::StartInput");
|
IMSA_HILOGI("InputMethodController::StartInput");
|
||||||
if (!mImms) {
|
if (!mImms) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MessageParcel data;
|
MessageParcel data;
|
||||||
if (!(data.WriteInterfaceToken(mImms->GetDescriptor())
|
if (!(data.WriteInterfaceToken(mImms->GetDescriptor()) && data.WriteRemoteObject(client->AsObject())
|
||||||
&& data.WriteRemoteObject(client->AsObject()))) {
|
&& data.WriteBool(isShowKeyboard))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
isStopInput = false;
|
isStopInput = false;
|
||||||
|
@ -81,7 +81,7 @@ namespace MiscServices {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputMethodSystemAbilityProxy::startInput(MessageParcel& data)
|
void InputMethodSystemAbilityProxy::startInput(MessageParcel &data)
|
||||||
{
|
{
|
||||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::startInput");
|
IMSA_HILOGI("InputMethodSystemAbilityProxy::startInput");
|
||||||
MessageParcel reply;
|
MessageParcel reply;
|
||||||
@ -155,6 +155,26 @@ namespace MiscServices {
|
|||||||
return ErrorCode::NO_ERROR;
|
return ErrorCode::NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t InputMethodSystemAbilityProxy::ShowCurrentInput(MessageParcel &data)
|
||||||
|
{
|
||||||
|
IMSA_HILOGI("InputMethodSystemAbilityProxy::ShowCurrentInput");
|
||||||
|
MessageParcel reply;
|
||||||
|
MessageOption option;
|
||||||
|
|
||||||
|
auto ret = Remote()->SendRequest(SHOW_CURRENT_INPUT, data, reply, option);
|
||||||
|
if (ret != NO_ERROR) {
|
||||||
|
IMSA_HILOGI("InputMethodSystemAbilityProxy::ShowCurrentInput SendRequest failed");
|
||||||
|
return ErrorCode::ERROR_KBD_SHOW_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = reply.ReadInt32();
|
||||||
|
if (ret != NO_ERROR) {
|
||||||
|
IMSA_HILOGI("InputMethodSystemAbilityProxy::ShowCurrentInput reply failed");
|
||||||
|
return ErrorCode::ERROR_KBD_SHOW_FAILED;
|
||||||
|
}
|
||||||
|
return ErrorCode::NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t InputMethodSystemAbilityProxy::Prepare(int32_t displayId, sptr<InputClientStub> &client,
|
int32_t InputMethodSystemAbilityProxy::Prepare(int32_t displayId, sptr<InputClientStub> &client,
|
||||||
sptr<InputDataChannelStub> &channel, InputAttribute &attribute)
|
sptr<InputDataChannelStub> &channel, InputAttribute &attribute)
|
||||||
{
|
{
|
||||||
|
@ -117,6 +117,14 @@ declare namespace inputMethod {
|
|||||||
stopInput(callback: AsyncCallback<boolean>): void;
|
stopInput(callback: AsyncCallback<boolean>): void;
|
||||||
|
|
||||||
stopInput(): Promise<boolean>;
|
stopInput(): Promise<boolean>;
|
||||||
|
|
||||||
|
showSoftKeyboard(callback: AsyncCallback<boolean>): void;
|
||||||
|
|
||||||
|
showSoftKeyboard():Promise<boolean>;
|
||||||
|
|
||||||
|
hideSoftKeyboard(callback: AsyncCallback): void;
|
||||||
|
|
||||||
|
hideSoftKeyboard():Promise<boolean>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
75
interfaces/kits/js/napi/inputmethodclient/BUILD.gn
Normal file
75
interfaces/kits/js/napi/inputmethodclient/BUILD.gn
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
# Copyright (C) 2022 Huawei Device Co., Ltd.
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import("//base/inputmethod/imf/inputmethod.gni")
|
||||||
|
import("//build/ohos.gni")
|
||||||
|
|
||||||
|
config("imf_config") {
|
||||||
|
visibility = [ ":*" ]
|
||||||
|
include_dirs = [ "include" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
config("imf_public_config") {
|
||||||
|
visibility = []
|
||||||
|
include_dirs = [
|
||||||
|
"include",
|
||||||
|
"${inputmethod_path}/frameworks/inputmethod_controller/include",
|
||||||
|
"${inputmethod_path}/services/dfx/include",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
ohos_shared_library("inputmethod") {
|
||||||
|
sources = [
|
||||||
|
"${inputmethod_path}/frameworks/inputmethod_controller/src/input_client_stub.cpp",
|
||||||
|
"${inputmethod_path}/frameworks/inputmethod_controller/src/input_data_channel_stub.cpp",
|
||||||
|
"${inputmethod_path}/frameworks/inputmethod_controller/src/input_method_controller.cpp",
|
||||||
|
"async_call.cpp",
|
||||||
|
"input_method_module.cpp",
|
||||||
|
"js_get_input_method_controller.cpp",
|
||||||
|
"js_get_input_method_setting.cpp",
|
||||||
|
"js_input_method.cpp",
|
||||||
|
]
|
||||||
|
|
||||||
|
configs = [ ":imf_config" ]
|
||||||
|
|
||||||
|
deps = [
|
||||||
|
"${ability_runtime_inner_api_path}/ability_manager:ability_manager",
|
||||||
|
"${ability_runtime_inner_api_path}/app_manager:app_manager",
|
||||||
|
"${ability_runtime_path}/frameworks/native/ability/native:abilitykit_native",
|
||||||
|
"${inputmethod_path}/services/dfx:inputmethod_dfx_static",
|
||||||
|
"//base/global/resource_management/frameworks/resmgr:global_resmgr",
|
||||||
|
"//base/inputmethod/imf/frameworks/inputmethod_ability:inputmethod_ability",
|
||||||
|
"//foundation/arkui/napi/:ace_napi",
|
||||||
|
"//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core",
|
||||||
|
"//foundation/communication/ipc/interfaces/innerkits/ipc_single:ipc_single",
|
||||||
|
"//foundation/multimodalinput/input/frameworks/proxy:libmmi-client",
|
||||||
|
"//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy",
|
||||||
|
]
|
||||||
|
|
||||||
|
external_deps = [
|
||||||
|
"ability_base:want",
|
||||||
|
"ability_runtime:runtime",
|
||||||
|
"bundle_framework:appexecfwk_base",
|
||||||
|
"bundle_framework:appexecfwk_core",
|
||||||
|
"c_utils:utils",
|
||||||
|
"eventhandler:libeventhandler",
|
||||||
|
"hiviewdfx_hilog_native:libhilog",
|
||||||
|
"ipc:ipc_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
public_configs = [ ":imf_public_config" ]
|
||||||
|
|
||||||
|
relative_install_dir = "module"
|
||||||
|
subsystem_name = "inputmethod"
|
||||||
|
part_name = "imf"
|
||||||
|
}
|
@ -32,6 +32,8 @@ napi_value JsGetInputMethodController::Init(napi_env env, napi_value info)
|
|||||||
|
|
||||||
napi_property_descriptor properties[] = {
|
napi_property_descriptor properties[] = {
|
||||||
DECLARE_NAPI_FUNCTION("stopInput", StopInput),
|
DECLARE_NAPI_FUNCTION("stopInput", StopInput),
|
||||||
|
DECLARE_NAPI_FUNCTION("hideSoftKeyboard", HideSoftKeyboard),
|
||||||
|
DECLARE_NAPI_FUNCTION("showSoftKeyboard", ShowSoftKeyboard),
|
||||||
};
|
};
|
||||||
napi_value cons = nullptr;
|
napi_value cons = nullptr;
|
||||||
NAPI_CALL(env, napi_define_class(env, IMC_CLASS_NAME.c_str(), IMC_CLASS_NAME.size(),
|
NAPI_CALL(env, napi_define_class(env, IMC_CLASS_NAME.c_str(), IMC_CLASS_NAME.size(),
|
||||||
@ -81,6 +83,58 @@ napi_value JsGetInputMethodController::GetInputMethodController(napi_env env, na
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
napi_value JsGetInputMethodController::HideSoftKeyboard(napi_env env, napi_callback_info info)
|
||||||
|
{
|
||||||
|
auto ctxt = std::make_shared<HideSoftKeyboardContext>();
|
||||||
|
auto input = [ctxt](napi_env env, size_t argc, napi_value *argv, napi_value self) -> napi_status {
|
||||||
|
NAPI_ASSERT_BASE(env, argc == 0 || argc == 1, " should null or 1 parameters!", napi_invalid_arg);
|
||||||
|
return napi_ok;
|
||||||
|
};
|
||||||
|
auto output = [ctxt](napi_env env, napi_value *result) -> napi_status {
|
||||||
|
napi_status status = napi_get_boolean(env, ctxt->isHideSoftKeyboard, result);
|
||||||
|
IMSA_HILOGE("output napi_get_boolean != nullptr[%{public}d]", result != nullptr);
|
||||||
|
return status;
|
||||||
|
};
|
||||||
|
auto exec = [ctxt](AsyncCall::Context *ctx) {
|
||||||
|
int32_t errCode = InputMethodController::GetInstance()->HideCurrentInput();
|
||||||
|
IMSA_HILOGI("exec HideCurrentInput %{public}d", errCode);
|
||||||
|
if (errCode == ErrorCode::NO_ERROR) {
|
||||||
|
IMSA_HILOGI("exec HideCurrentInput success");
|
||||||
|
ctxt->status = napi_ok;
|
||||||
|
ctxt->isHideSoftKeyboard = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ctxt->SetAction(std::move(input), std::move(output));
|
||||||
|
AsyncCall asyncCall(env, info, std::dynamic_pointer_cast<AsyncCall::Context>(ctxt), 0);
|
||||||
|
return asyncCall.Call(env, exec);
|
||||||
|
}
|
||||||
|
|
||||||
|
napi_value JsGetInputMethodController::ShowSoftKeyboard(napi_env env, napi_callback_info info)
|
||||||
|
{
|
||||||
|
auto ctxt = std::make_shared<ShowSoftKeyboardContext>();
|
||||||
|
auto input = [ctxt](napi_env env, size_t argc, napi_value *argv, napi_value self) -> napi_status {
|
||||||
|
NAPI_ASSERT_BASE(env, argc == 0 || argc == 1, " should null or 1 parameters!", napi_invalid_arg);
|
||||||
|
return napi_ok;
|
||||||
|
};
|
||||||
|
auto output = [ctxt](napi_env env, napi_value *result) -> napi_status {
|
||||||
|
napi_status status = napi_get_boolean(env, ctxt->isShowSoftKeyboard, result);
|
||||||
|
IMSA_HILOGE("output napi_get_boolean != nullptr[%{public}d]", result != nullptr);
|
||||||
|
return status;
|
||||||
|
};
|
||||||
|
auto exec = [ctxt](AsyncCall::Context *ctx) {
|
||||||
|
int32_t errCode = InputMethodController::GetInstance()->ShowCurrentInput();
|
||||||
|
IMSA_HILOGI("exec ShowCurrentInput %{public}d", errCode);
|
||||||
|
if (errCode == ErrorCode::NO_ERROR) {
|
||||||
|
IMSA_HILOGI("exec ShowCurrentInput success");
|
||||||
|
ctxt->status = napi_ok;
|
||||||
|
ctxt->isShowSoftKeyboard = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ctxt->SetAction(std::move(input), std::move(output));
|
||||||
|
AsyncCall asyncCall(env, info, std::dynamic_pointer_cast<AsyncCall::Context>(ctxt), 0);
|
||||||
|
return asyncCall.Call(env, exec);
|
||||||
|
}
|
||||||
|
|
||||||
napi_value JsGetInputMethodController::StopInput(napi_env env, napi_callback_info info)
|
napi_value JsGetInputMethodController::StopInput(napi_env env, napi_callback_info info)
|
||||||
{
|
{
|
||||||
auto ctxt = std::make_shared<StopInputContext>();
|
auto ctxt = std::make_shared<StopInputContext>();
|
||||||
|
@ -15,17 +15,57 @@
|
|||||||
#ifndef INTERFACE_KITS_JS_GETINPUT_METHOD_CCONTROLLER_H
|
#ifndef INTERFACE_KITS_JS_GETINPUT_METHOD_CCONTROLLER_H
|
||||||
#define INTERFACE_KITS_JS_GETINPUT_METHOD_CCONTROLLER_H
|
#define INTERFACE_KITS_JS_GETINPUT_METHOD_CCONTROLLER_H
|
||||||
|
|
||||||
#include "global.h"
|
|
||||||
#include "async_call.h"
|
#include "async_call.h"
|
||||||
|
#include "global.h"
|
||||||
#include "js_input_method.h"
|
#include "js_input_method.h"
|
||||||
|
|
||||||
namespace OHOS {
|
namespace OHOS {
|
||||||
namespace MiscServices {
|
namespace MiscServices {
|
||||||
|
struct HideSoftKeyboardContext : public AsyncCall::Context {
|
||||||
|
bool isHideSoftKeyboard = false;
|
||||||
|
napi_status status = napi_generic_failure;
|
||||||
|
HideSoftKeyboardContext() : Context(nullptr, nullptr){};
|
||||||
|
HideSoftKeyboardContext(InputAction input, OutputAction output) : Context(std::move(input), std::move(output)){};
|
||||||
|
|
||||||
|
napi_status operator()(napi_env env, size_t argc, napi_value *argv, napi_value self) override
|
||||||
|
{
|
||||||
|
NAPI_ASSERT_BASE(env, self != nullptr, "self is nullptr", napi_invalid_arg);
|
||||||
|
return Context::operator()(env, argc, argv, self);
|
||||||
|
}
|
||||||
|
napi_status operator()(napi_env env, napi_value *result) override
|
||||||
|
{
|
||||||
|
if (status != napi_ok) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
return Context::operator()(env, result);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ShowSoftKeyboardContext : public AsyncCall::Context {
|
||||||
|
bool isShowSoftKeyboard = false;
|
||||||
|
napi_status status = napi_generic_failure;
|
||||||
|
ShowSoftKeyboardContext() : Context(nullptr, nullptr){};
|
||||||
|
ShowSoftKeyboardContext(InputAction input, OutputAction output) : Context(std::move(input), std::move(output)){};
|
||||||
|
|
||||||
|
napi_status operator()(napi_env env, size_t argc, napi_value *argv, napi_value self) override
|
||||||
|
{
|
||||||
|
NAPI_ASSERT_BASE(env, self != nullptr, "self is nullptr", napi_invalid_arg);
|
||||||
|
return Context::operator()(env, argc, argv, self);
|
||||||
|
}
|
||||||
|
napi_status operator()(napi_env env, napi_value *result) override
|
||||||
|
{
|
||||||
|
if (status != napi_ok) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
return Context::operator()(env, result);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
struct StopInputContext : public AsyncCall::Context {
|
struct StopInputContext : public AsyncCall::Context {
|
||||||
bool isStopInput = false;
|
bool isStopInput = false;
|
||||||
napi_status status = napi_generic_failure;
|
napi_status status = napi_generic_failure;
|
||||||
StopInputContext() : Context(nullptr, nullptr) { };
|
StopInputContext() : Context(nullptr, nullptr){};
|
||||||
StopInputContext(InputAction input, OutputAction output) : Context(std::move(input), std::move(output)) { };
|
StopInputContext(InputAction input, OutputAction output) : Context(std::move(input), std::move(output)){};
|
||||||
|
|
||||||
napi_status operator()(napi_env env, size_t argc, napi_value *argv, napi_value self) override
|
napi_status operator()(napi_env env, size_t argc, napi_value *argv, napi_value self) override
|
||||||
{
|
{
|
||||||
@ -47,12 +87,15 @@ public:
|
|||||||
~JsGetInputMethodController() = default;
|
~JsGetInputMethodController() = default;
|
||||||
static napi_value Init(napi_env env, napi_value info);
|
static napi_value Init(napi_env env, napi_value info);
|
||||||
static napi_value GetInputMethodController(napi_env env, napi_callback_info info);
|
static napi_value GetInputMethodController(napi_env env, napi_callback_info info);
|
||||||
static napi_value StopInput(napi_env env, napi_callback_info Info);
|
static napi_value HideSoftKeyboard(napi_env env, napi_callback_info info);
|
||||||
|
static napi_value ShowSoftKeyboard(napi_env env, napi_callback_info info);
|
||||||
|
static napi_value StopInput(napi_env env, napi_callback_info info);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static napi_value JsConstructor(napi_env env, napi_callback_info cbinfo);
|
static napi_value JsConstructor(napi_env env, napi_callback_info cbinfo);
|
||||||
static const std::string IMC_CLASS_NAME;
|
static const std::string IMC_CLASS_NAME;
|
||||||
static thread_local napi_ref IMCRef_;
|
static thread_local napi_ref IMCRef_;
|
||||||
};
|
};
|
||||||
}
|
} // namespace MiscServices
|
||||||
}
|
} // namespace OHOS
|
||||||
#endif // INTERFACE_KITS_JS_GETINPUT_METHOD_CCONTROLLER_H
|
#endif // INTERFACE_KITS_JS_GETINPUT_METHOD_CCONTROLLER_H
|
||||||
|
@ -38,6 +38,7 @@ namespace MiscServices {
|
|||||||
START_INPUT,
|
START_INPUT,
|
||||||
STOP_INPUT,
|
STOP_INPUT,
|
||||||
HIDE_CURRENT_INPUT,
|
HIDE_CURRENT_INPUT,
|
||||||
|
SHOW_CURRENT_INPUT,
|
||||||
SET_INPUT_METHOD_CORE,
|
SET_INPUT_METHOD_CORE,
|
||||||
GET_DISPLAY_MODE,
|
GET_DISPLAY_MODE,
|
||||||
GET_KEYBOARD_WINDOW_HEIGHT,
|
GET_KEYBOARD_WINDOW_HEIGHT,
|
||||||
@ -58,6 +59,7 @@ namespace MiscServices {
|
|||||||
virtual void stopInput(MessageParcel& data) = 0;
|
virtual void stopInput(MessageParcel& data) = 0;
|
||||||
virtual void SetCoreAndAgent(MessageParcel& data) = 0;
|
virtual void SetCoreAndAgent(MessageParcel& data) = 0;
|
||||||
virtual int32_t HideCurrentInput(MessageParcel& data) = 0;
|
virtual int32_t HideCurrentInput(MessageParcel& data) = 0;
|
||||||
|
virtual int32_t ShowCurrentInput(MessageParcel& data) = 0;
|
||||||
|
|
||||||
virtual int32_t displayOptionalInputMethod(MessageParcel& data) = 0;
|
virtual int32_t displayOptionalInputMethod(MessageParcel& data) = 0;
|
||||||
virtual int32_t getDisplayMode(int32_t &retMode) = 0;
|
virtual int32_t getDisplayMode(int32_t &retMode) = 0;
|
||||||
|
@ -35,6 +35,7 @@ namespace MiscServices {
|
|||||||
void stopInput(MessageParcel& data) override;
|
void stopInput(MessageParcel& data) override;
|
||||||
void SetCoreAndAgent(MessageParcel& data) override;
|
void SetCoreAndAgent(MessageParcel& data) override;
|
||||||
int32_t HideCurrentInput(MessageParcel& data) override;
|
int32_t HideCurrentInput(MessageParcel& data) override;
|
||||||
|
int32_t ShowCurrentInput(MessageParcel& data) override;
|
||||||
int32_t displayOptionalInputMethod(MessageParcel& data) override;
|
int32_t displayOptionalInputMethod(MessageParcel& data) override;
|
||||||
virtual int32_t listInputMethodByUserId(int32_t userId, std::vector<InputMethodProperty*> *properties) = 0;
|
virtual int32_t listInputMethodByUserId(int32_t userId, std::vector<InputMethodProperty*> *properties) = 0;
|
||||||
int32_t SwitchInputMethod(MessageParcel &data);
|
int32_t SwitchInputMethod(MessageParcel &data);
|
||||||
|
@ -46,6 +46,7 @@ namespace MessageID {
|
|||||||
MSG_ID_RELEASE_INPUT, // release input
|
MSG_ID_RELEASE_INPUT, // release input
|
||||||
MSG_ID_SET_CORE_AND_AGENT,
|
MSG_ID_SET_CORE_AND_AGENT,
|
||||||
MSG_HIDE_CURRENT_INPUT,
|
MSG_HIDE_CURRENT_INPUT,
|
||||||
|
MSG_SHOW_CURRENT_INPUT,
|
||||||
MSG_ID_SWITCH_INPUT_METHOD, // switch input method
|
MSG_ID_SWITCH_INPUT_METHOD, // switch input method
|
||||||
|
|
||||||
// the request to handle the condition that the remote object died
|
// the request to handle the condition that the remote object died
|
||||||
|
@ -171,6 +171,7 @@ namespace MiscServices {
|
|||||||
void OnClientDied(const wptr<IRemoteObject>& who);
|
void OnClientDied(const wptr<IRemoteObject>& who);
|
||||||
void OnImsDied(const wptr<IRemoteObject>& who);
|
void OnImsDied(const wptr<IRemoteObject>& who);
|
||||||
void OnHideKeyboardSelf(int flags);
|
void OnHideKeyboardSelf(int flags);
|
||||||
|
void OnShowKeyboardSelf(int flags);
|
||||||
void OnAdvanceToNext();
|
void OnAdvanceToNext();
|
||||||
void OnSetDisplayMode(int mode);
|
void OnSetDisplayMode(int mode);
|
||||||
void OnRestartIms(int index, const std::u16string& imeId);
|
void OnRestartIms(int index, const std::u16string& imeId);
|
||||||
@ -181,7 +182,7 @@ namespace MiscServices {
|
|||||||
int RemoveClient(const sptr<IInputClient>& inputClient, int retClientNum);
|
int RemoveClient(const sptr<IInputClient>& inputClient, int retClientNum);
|
||||||
int StartInputMethod(int index);
|
int StartInputMethod(int index);
|
||||||
int StopInputMethod(int index);
|
int StopInputMethod(int index);
|
||||||
int ShowKeyboard(const sptr<IInputClient>& inputClient);
|
int ShowKeyboard(const sptr<IInputClient>& inputClient, bool isShowKeyboard);
|
||||||
int HideKeyboard(const sptr<IInputClient>& inputClient);
|
int HideKeyboard(const sptr<IInputClient>& inputClient);
|
||||||
void SetDisplayId(int displayId);
|
void SetDisplayId(int displayId);
|
||||||
int GetImeIndex(const sptr<IInputClient>& inputClient);
|
int GetImeIndex(const sptr<IInputClient>& inputClient);
|
||||||
|
@ -603,6 +603,7 @@ namespace MiscServices {
|
|||||||
case MSG_ID_START_INPUT:
|
case MSG_ID_START_INPUT:
|
||||||
case MSG_ID_STOP_INPUT:
|
case MSG_ID_STOP_INPUT:
|
||||||
case MSG_HIDE_CURRENT_INPUT:
|
case MSG_HIDE_CURRENT_INPUT:
|
||||||
|
case MSG_SHOW_CURRENT_INPUT:
|
||||||
case MSG_ID_SET_CORE_AND_AGENT:
|
case MSG_ID_SET_CORE_AND_AGENT:
|
||||||
case MSG_ID_HIDE_KEYBOARD_SELF:
|
case MSG_ID_HIDE_KEYBOARD_SELF:
|
||||||
case MSG_ID_SET_DISPLAY_MODE:
|
case MSG_ID_SET_DISPLAY_MODE:
|
||||||
|
@ -170,6 +170,11 @@ namespace MiscServices {
|
|||||||
reply.WriteInt32(NO_ERROR);
|
reply.WriteInt32(NO_ERROR);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SHOW_CURRENT_INPUT: {
|
||||||
|
ShowCurrentInput(data);
|
||||||
|
reply.WriteInt32(NO_ERROR);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case SWITCH_INPUT_METHOD: {
|
case SWITCH_INPUT_METHOD: {
|
||||||
int32_t ret = SwitchInputMethod(data);
|
int32_t ret = SwitchInputMethod(data);
|
||||||
reply.WriteInt32(ret);
|
reply.WriteInt32(ret);
|
||||||
@ -255,6 +260,7 @@ namespace MiscServices {
|
|||||||
MessageParcel *parcel = new MessageParcel();
|
MessageParcel *parcel = new MessageParcel();
|
||||||
parcel->WriteInt32(userId);
|
parcel->WriteInt32(userId);
|
||||||
parcel->WriteRemoteObject(data.ReadRemoteObject());
|
parcel->WriteRemoteObject(data.ReadRemoteObject());
|
||||||
|
parcel->WriteBool(data.ReadBool());
|
||||||
|
|
||||||
Message *msg = new Message(MSG_ID_START_INPUT, parcel);
|
Message *msg = new Message(MSG_ID_START_INPUT, parcel);
|
||||||
MessageHandler::Instance()->SendMessage(msg);
|
MessageHandler::Instance()->SendMessage(msg);
|
||||||
@ -311,6 +317,19 @@ namespace MiscServices {
|
|||||||
return ErrorCode::NO_ERROR;
|
return ErrorCode::NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t InputMethodSystemAbilityStub::ShowCurrentInput(MessageParcel &data)
|
||||||
|
{
|
||||||
|
IMSA_HILOGI("InputMethodSystemAbilityStub::ShowCurrentInput");
|
||||||
|
int32_t uid = IPCSkeleton::GetCallingUid();
|
||||||
|
int32_t userId = getUserId(uid);
|
||||||
|
MessageParcel *parcel = new MessageParcel();
|
||||||
|
parcel->WriteInt32(userId);
|
||||||
|
|
||||||
|
Message *msg = new Message(MSG_SHOW_CURRENT_INPUT, parcel);
|
||||||
|
MessageHandler::Instance()->SendMessage(msg);
|
||||||
|
return ErrorCode::NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t InputMethodSystemAbilityStub::SwitchInputMethod(MessageParcel &data)
|
int32_t InputMethodSystemAbilityStub::SwitchInputMethod(MessageParcel &data)
|
||||||
{
|
{
|
||||||
IMSA_HILOGI("InputMethodSystemAbilityStub::switchInputMethod");
|
IMSA_HILOGI("InputMethodSystemAbilityStub::switchInputMethod");
|
||||||
|
@ -186,6 +186,10 @@ namespace MiscServices {
|
|||||||
OnHideKeyboardSelf(0);
|
OnHideKeyboardSelf(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case MSG_SHOW_CURRENT_INPUT: {
|
||||||
|
OnShowKeyboardSelf(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -271,7 +275,7 @@ namespace MiscServices {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (needReshowClient && GetImeIndex(needReshowClient) == i) {
|
if (needReshowClient && GetImeIndex(needReshowClient) == i) {
|
||||||
ShowKeyboard(needReshowClient);
|
ShowKeyboard(needReshowClient, true);
|
||||||
needReshowClient = nullptr;
|
needReshowClient = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -478,7 +482,7 @@ namespace MiscServices {
|
|||||||
\return ErrorCode::ERROR_KBD_SHOW_FAILED failed to show keyboard
|
\return ErrorCode::ERROR_KBD_SHOW_FAILED failed to show keyboard
|
||||||
\return other errors returned by binder driver
|
\return other errors returned by binder driver
|
||||||
*/
|
*/
|
||||||
int PerUserSession::ShowKeyboard(const sptr<IInputClient>& inputClient)
|
int PerUserSession::ShowKeyboard(const sptr<IInputClient>& inputClient, bool isShowKeyboard)
|
||||||
{
|
{
|
||||||
IMSA_HILOGI("PerUserSession::ShowKeyboard");
|
IMSA_HILOGI("PerUserSession::ShowKeyboard");
|
||||||
ClientInfo *clientInfo = GetClientInfo(inputClient);
|
ClientInfo *clientInfo = GetClientInfo(inputClient);
|
||||||
@ -493,7 +497,7 @@ namespace MiscServices {
|
|||||||
return ErrorCode::ERROR_NULL_POINTER;
|
return ErrorCode::ERROR_NULL_POINTER;
|
||||||
}
|
}
|
||||||
|
|
||||||
imsCore[0]->showKeyboard(clientInfo->channel);
|
imsCore[0]->showKeyboard(clientInfo->channel, isShowKeyboard);
|
||||||
|
|
||||||
currentClient = inputClient;
|
currentClient = inputClient;
|
||||||
return ErrorCode::NO_ERROR;
|
return ErrorCode::NO_ERROR;
|
||||||
@ -799,6 +803,16 @@ namespace MiscServices {
|
|||||||
HideKeyboard(currentClient);
|
HideKeyboard(currentClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! Show current keyboard
|
||||||
|
\param flag the flag to show keyboard.
|
||||||
|
*/
|
||||||
|
void PerUserSession::OnShowKeyboardSelf(int flags)
|
||||||
|
{
|
||||||
|
IMSA_HILOGI("PerUserSession::OnShowKeyboardSelf");
|
||||||
|
(void) flags;
|
||||||
|
ShowKeyboard(currentClient, true);
|
||||||
|
}
|
||||||
|
|
||||||
/*! Switch to next keyboard type
|
/*! Switch to next keyboard type
|
||||||
*/
|
*/
|
||||||
void PerUserSession::OnAdvanceToNext()
|
void PerUserSession::OnAdvanceToNext()
|
||||||
@ -875,7 +889,7 @@ namespace MiscServices {
|
|||||||
int ret = StartInputMethod(index);
|
int ret = StartInputMethod(index);
|
||||||
if (needReshowClient && GetImeIndex(needReshowClient) == index) {
|
if (needReshowClient && GetImeIndex(needReshowClient) == index) {
|
||||||
if (ret == ErrorCode::NO_ERROR) {
|
if (ret == ErrorCode::NO_ERROR) {
|
||||||
ShowKeyboard(needReshowClient);
|
ShowKeyboard(needReshowClient, true);
|
||||||
}
|
}
|
||||||
needReshowClient = nullptr;
|
needReshowClient = nullptr;
|
||||||
}
|
}
|
||||||
@ -1253,7 +1267,8 @@ namespace MiscServices {
|
|||||||
if (imsCore[0]) {
|
if (imsCore[0]) {
|
||||||
imsCore[0]->SetClientState(true);
|
imsCore[0]->SetClientState(true);
|
||||||
}
|
}
|
||||||
ShowKeyboard(client);
|
bool isShowKeyboard = data->ReadBool();
|
||||||
|
ShowKeyboard(client, isShowKeyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerUserSession::SetCoreAndAgent(Message *msg)
|
void PerUserSession::SetCoreAndAgent(Message *msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user