122736c2fSopenharmony_ci/*
222736c2fSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
322736c2fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
422736c2fSopenharmony_ci * you may not use this file except in compliance with the License.
522736c2fSopenharmony_ci * You may obtain a copy of the License at
622736c2fSopenharmony_ci *
722736c2fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0
822736c2fSopenharmony_ci *
922736c2fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1022736c2fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1122736c2fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1222736c2fSopenharmony_ci * See the License for the specific language governing permissions and
1322736c2fSopenharmony_ci * limitations under the License.
1422736c2fSopenharmony_ci */
1522736c2fSopenharmony_ci
1622736c2fSopenharmony_ci#include "input_method_ffi.h"
1722736c2fSopenharmony_ci
1822736c2fSopenharmony_ci#include "inputmethod_trace.h"
1922736c2fSopenharmony_ci#include "cj_input_method_controller.h"
2022736c2fSopenharmony_ci#include "input_method_property.h"
2122736c2fSopenharmony_ci#include "setting_listeners.h"
2222736c2fSopenharmony_ci#include "global.h"
2322736c2fSopenharmony_ci#include "utils.h"
2422736c2fSopenharmony_ci
2522736c2fSopenharmony_cinamespace OHOS::MiscServices {
2622736c2fSopenharmony_ciextern "C" {
2722736c2fSopenharmony_ciint32_t FfiInputMethodGetDefaultInputMethod(CInputMethodProperty &props)
2822736c2fSopenharmony_ci{
2922736c2fSopenharmony_ci    auto ctrl = InputMethodController::GetInstance();
3022736c2fSopenharmony_ci    if (ctrl == nullptr) {
3122736c2fSopenharmony_ci        return ERR_NO_MEMORY;
3222736c2fSopenharmony_ci    }
3322736c2fSopenharmony_ci    std::shared_ptr<Property> property;
3422736c2fSopenharmony_ci    int32_t ret = ctrl->GetDefaultInputMethod(property);
3522736c2fSopenharmony_ci    if (property == nullptr) {
3622736c2fSopenharmony_ci        IMSA_HILOGE("default input method is nullptr!");
3722736c2fSopenharmony_ci        return ret;
3822736c2fSopenharmony_ci    }
3922736c2fSopenharmony_ci    Utils::InputMethodProperty2C(props, *property);
4022736c2fSopenharmony_ci    return ret;
4122736c2fSopenharmony_ci}
4222736c2fSopenharmony_ci
4322736c2fSopenharmony_ciint32_t FfiInputMethodGetCurrentInputMethod(CInputMethodProperty &props)
4422736c2fSopenharmony_ci{
4522736c2fSopenharmony_ci    auto ctrl = InputMethodController::GetInstance();
4622736c2fSopenharmony_ci    if (ctrl == nullptr) {
4722736c2fSopenharmony_ci        return ERR_NO_MEMORY;
4822736c2fSopenharmony_ci    }
4922736c2fSopenharmony_ci    std::shared_ptr<Property> property = ctrl->GetCurrentInputMethod();
5022736c2fSopenharmony_ci    if (property == nullptr) {
5122736c2fSopenharmony_ci        IMSA_HILOGE("current input method is nullptr!");
5222736c2fSopenharmony_ci        return ERR_NO_MEMORY;
5322736c2fSopenharmony_ci    }
5422736c2fSopenharmony_ci    Utils::InputMethodProperty2C(props, *property);
5522736c2fSopenharmony_ci    return 0;
5622736c2fSopenharmony_ci}
5722736c2fSopenharmony_ci
5822736c2fSopenharmony_ciint32_t FfiInputMethodSwitchInputMethod(bool &result, CInputMethodProperty props)
5922736c2fSopenharmony_ci{
6022736c2fSopenharmony_ci    InputMethodSyncTrace tracer("CJInputMethod_SwitchInputMethod");
6122736c2fSopenharmony_ci    auto ctrl = InputMethodController::GetInstance();
6222736c2fSopenharmony_ci    if (ctrl == nullptr) {
6322736c2fSopenharmony_ci        return ERR_NO_MEMORY;
6422736c2fSopenharmony_ci    }
6522736c2fSopenharmony_ci    int32_t errCode =
6622736c2fSopenharmony_ci        ctrl->SwitchInputMethod(SwitchTrigger::CURRENT_IME, std::string(props.name), std::string(props.id));
6722736c2fSopenharmony_ci    if (errCode == ErrorCode::NO_ERROR) {
6822736c2fSopenharmony_ci        result = true;
6922736c2fSopenharmony_ci    }
7022736c2fSopenharmony_ci    return errCode;
7122736c2fSopenharmony_ci}
7222736c2fSopenharmony_ci
7322736c2fSopenharmony_ciint32_t FfiInputMethodSwitchCurrentInputMethodSubtype(bool &result, CInputMethodSubtype target)
7422736c2fSopenharmony_ci{
7522736c2fSopenharmony_ci    InputMethodSyncTrace tracer("CJInputMethod_SwitchCurrentInputMethodSubtype");
7622736c2fSopenharmony_ci    auto ctrl = InputMethodController::GetInstance();
7722736c2fSopenharmony_ci    if (ctrl == nullptr) {
7822736c2fSopenharmony_ci        return ERR_NO_MEMORY;
7922736c2fSopenharmony_ci    }
8022736c2fSopenharmony_ci    int32_t errCode =
8122736c2fSopenharmony_ci        ctrl->SwitchInputMethod(SwitchTrigger::CURRENT_IME, std::string(target.name), std::string(target.id));
8222736c2fSopenharmony_ci    if (errCode == ErrorCode::NO_ERROR) {
8322736c2fSopenharmony_ci        result = true;
8422736c2fSopenharmony_ci    }
8522736c2fSopenharmony_ci    return errCode;
8622736c2fSopenharmony_ci}
8722736c2fSopenharmony_ci
8822736c2fSopenharmony_ciint32_t FfiInputMethodGetCurrentInputMethodSubtype(CInputMethodSubtype &props)
8922736c2fSopenharmony_ci{
9022736c2fSopenharmony_ci    auto ctrl = InputMethodController::GetInstance();
9122736c2fSopenharmony_ci    if (ctrl == nullptr) {
9222736c2fSopenharmony_ci        return ERR_NO_MEMORY;
9322736c2fSopenharmony_ci    }
9422736c2fSopenharmony_ci    std::shared_ptr<SubProperty> subProperty = ctrl->GetCurrentInputMethodSubtype();
9522736c2fSopenharmony_ci    if (subProperty == nullptr) {
9622736c2fSopenharmony_ci        IMSA_HILOGE("current input method subtype is nullptr!");
9722736c2fSopenharmony_ci        return ERR_NO_MEMORY;
9822736c2fSopenharmony_ci    }
9922736c2fSopenharmony_ci    Utils::InputMethodSubProperty2C(props, *subProperty);
10022736c2fSopenharmony_ci    return 0;
10122736c2fSopenharmony_ci}
10222736c2fSopenharmony_ci
10322736c2fSopenharmony_ciint32_t FfiInputMethodSwitchCurrentInputMethodAndSubtype(bool &result,
10422736c2fSopenharmony_ci    CInputMethodProperty target, CInputMethodSubtype subtype)
10522736c2fSopenharmony_ci{
10622736c2fSopenharmony_ci    InputMethodSyncTrace tracer("CJInputMethod_SwitchCurrentInputMethodAndSubtype");
10722736c2fSopenharmony_ci    auto ctrl = InputMethodController::GetInstance();
10822736c2fSopenharmony_ci    if (ctrl == nullptr) {
10922736c2fSopenharmony_ci        return ERR_NO_MEMORY;
11022736c2fSopenharmony_ci    }
11122736c2fSopenharmony_ci    int32_t errCode = ctrl->SwitchInputMethod(SwitchTrigger::CURRENT_IME,
11222736c2fSopenharmony_ci        std::string(subtype.name), std::string(subtype.id));
11322736c2fSopenharmony_ci    if (errCode == ErrorCode::NO_ERROR) {
11422736c2fSopenharmony_ci        result = true;
11522736c2fSopenharmony_ci    }
11622736c2fSopenharmony_ci    return errCode;
11722736c2fSopenharmony_ci}
11822736c2fSopenharmony_ci
11922736c2fSopenharmony_ciint32_t FfiInputMethodGetSystemInputMethodConfigAbility(CElementName &elem)
12022736c2fSopenharmony_ci{
12122736c2fSopenharmony_ci    OHOS::AppExecFwk::ElementName inputMethodConfig;
12222736c2fSopenharmony_ci    auto ctrl = InputMethodController::GetInstance();
12322736c2fSopenharmony_ci    if (ctrl == nullptr) {
12422736c2fSopenharmony_ci        return ERR_NO_MEMORY;
12522736c2fSopenharmony_ci    }
12622736c2fSopenharmony_ci    int32_t ret = ctrl->GetInputMethodConfig(inputMethodConfig);
12722736c2fSopenharmony_ci    if (ret == ErrorCode::NO_ERROR) {
12822736c2fSopenharmony_ci        elem.deviceId = Utils::MallocCString(inputMethodConfig.GetDeviceID());
12922736c2fSopenharmony_ci        elem.bundleName = Utils::MallocCString(inputMethodConfig.GetBundleName());
13022736c2fSopenharmony_ci        elem.abilityName = Utils::MallocCString(inputMethodConfig.GetAbilityName());
13122736c2fSopenharmony_ci        elem.moduleName = Utils::MallocCString(inputMethodConfig.GetModuleName());
13222736c2fSopenharmony_ci    }
13322736c2fSopenharmony_ci    return ret;
13422736c2fSopenharmony_ci}
13522736c2fSopenharmony_ci
13622736c2fSopenharmony_ciRetInputMethodSubtype FfiInputMethodSettingListInputMethodSubtype(CInputMethodProperty props)
13722736c2fSopenharmony_ci{
13822736c2fSopenharmony_ci    IMSA_HILOGD("run in ListInputMethodSubtype");
13922736c2fSopenharmony_ci    RetInputMethodSubtype ret{};
14022736c2fSopenharmony_ci    Property property = Utils::C2InputMethodProperty(props);
14122736c2fSopenharmony_ci    std::vector<SubProperty> subProps;
14222736c2fSopenharmony_ci    auto ctrl = InputMethodController::GetInstance();
14322736c2fSopenharmony_ci    if (ctrl == nullptr) {
14422736c2fSopenharmony_ci        ret.code = ERR_NO_MEMORY;
14522736c2fSopenharmony_ci        return ret;
14622736c2fSopenharmony_ci    }
14722736c2fSopenharmony_ci    int32_t errCode = ctrl->ListInputMethodSubtype(property, subProps);
14822736c2fSopenharmony_ci    ret.code = errCode;
14922736c2fSopenharmony_ci    if (errCode != ErrorCode::NO_ERROR) {
15022736c2fSopenharmony_ci        return ret;
15122736c2fSopenharmony_ci    }
15222736c2fSopenharmony_ci    IMSA_HILOGI("exec ListInputMethodSubtype success");
15322736c2fSopenharmony_ci    ret.size = static_cast<int64_t>(subProps.size());
15422736c2fSopenharmony_ci    if (ret.size > 0) {
15522736c2fSopenharmony_ci        ret.head = static_cast<CInputMethodSubtype *>(malloc(sizeof(CInputMethodSubtype) * ret.size));
15622736c2fSopenharmony_ci    }
15722736c2fSopenharmony_ci    if (ret.head == nullptr) {
15822736c2fSopenharmony_ci        ret.size = 0;
15922736c2fSopenharmony_ci        return ret;
16022736c2fSopenharmony_ci    }
16122736c2fSopenharmony_ci    for (unsigned int i = 0; i < ret.size; i++) {
16222736c2fSopenharmony_ci        CInputMethodSubtype props;
16322736c2fSopenharmony_ci        Utils::InputMethodSubProperty2C(props, subProps[i]);
16422736c2fSopenharmony_ci        ret.head[i] = props;
16522736c2fSopenharmony_ci    }
16622736c2fSopenharmony_ci    return ret;
16722736c2fSopenharmony_ci}
16822736c2fSopenharmony_ci
16922736c2fSopenharmony_ciRetInputMethodSubtype FfiInputMethodSettingListCurrentInputMethodSubtype()
17022736c2fSopenharmony_ci{
17122736c2fSopenharmony_ci    IMSA_HILOGD("run in ListCurrentInputMethodSubtype");
17222736c2fSopenharmony_ci    RetInputMethodSubtype ret{};
17322736c2fSopenharmony_ci    std::vector<SubProperty> subProps;
17422736c2fSopenharmony_ci    auto ctrl = InputMethodController::GetInstance();
17522736c2fSopenharmony_ci    if (ctrl == nullptr) {
17622736c2fSopenharmony_ci        ret.code = ERR_NO_MEMORY;
17722736c2fSopenharmony_ci        return ret;
17822736c2fSopenharmony_ci    }
17922736c2fSopenharmony_ci    int32_t errCode = ctrl->ListCurrentInputMethodSubtype(subProps);
18022736c2fSopenharmony_ci    ret.code = errCode;
18122736c2fSopenharmony_ci    if (errCode != ErrorCode::NO_ERROR) {
18222736c2fSopenharmony_ci        return ret;
18322736c2fSopenharmony_ci    }
18422736c2fSopenharmony_ci    IMSA_HILOGI("exec ListCurrentInputMethodSubtype success.");
18522736c2fSopenharmony_ci    ret.size = static_cast<int64_t>(subProps.size());
18622736c2fSopenharmony_ci    if (ret.size > 0) {
18722736c2fSopenharmony_ci        ret.head = static_cast<CInputMethodSubtype *>(malloc(sizeof(CInputMethodSubtype) * ret.size));
18822736c2fSopenharmony_ci    }
18922736c2fSopenharmony_ci    if (ret.head == nullptr) {
19022736c2fSopenharmony_ci        ret.size = 0;
19122736c2fSopenharmony_ci        return ret;
19222736c2fSopenharmony_ci    }
19322736c2fSopenharmony_ci    for (unsigned int i = 0; i < ret.size; i++) {
19422736c2fSopenharmony_ci        CInputMethodSubtype props;
19522736c2fSopenharmony_ci        Utils::InputMethodSubProperty2C(props, subProps[i]);
19622736c2fSopenharmony_ci        ret.head[i] = props;
19722736c2fSopenharmony_ci    }
19822736c2fSopenharmony_ci    return ret;
19922736c2fSopenharmony_ci}
20022736c2fSopenharmony_ci
20122736c2fSopenharmony_ciRetInputMethodProperty FfiInputMethodSettingGetInputMethods(bool enable)
20222736c2fSopenharmony_ci{
20322736c2fSopenharmony_ci    IMSA_HILOGD("run in");
20422736c2fSopenharmony_ci    RetInputMethodProperty ret{};
20522736c2fSopenharmony_ci    std::vector<Property> properties;
20622736c2fSopenharmony_ci    auto ctrl = InputMethodController::GetInstance();
20722736c2fSopenharmony_ci    if (ctrl == nullptr) {
20822736c2fSopenharmony_ci        ret.code = ERR_NO_MEMORY;
20922736c2fSopenharmony_ci        return ret;
21022736c2fSopenharmony_ci    }
21122736c2fSopenharmony_ci    int32_t errCode = ctrl->ListInputMethod(enable, properties);
21222736c2fSopenharmony_ci    ret.code = errCode;
21322736c2fSopenharmony_ci    if (errCode != ErrorCode::NO_ERROR) {
21422736c2fSopenharmony_ci        return ret;
21522736c2fSopenharmony_ci    }
21622736c2fSopenharmony_ci    ret.size = static_cast<int64_t>(properties.size());
21722736c2fSopenharmony_ci    if (ret.size > 0) {
21822736c2fSopenharmony_ci        ret.head = static_cast<CInputMethodProperty *>(malloc(sizeof(CInputMethodProperty) * ret.size));
21922736c2fSopenharmony_ci    }
22022736c2fSopenharmony_ci    if (ret.head == nullptr) {
22122736c2fSopenharmony_ci        ret.size = 0;
22222736c2fSopenharmony_ci        return ret;
22322736c2fSopenharmony_ci    }
22422736c2fSopenharmony_ci    for (unsigned int i = 0; i < ret.size; i++) {
22522736c2fSopenharmony_ci        CInputMethodProperty props;
22622736c2fSopenharmony_ci        Utils::InputMethodProperty2C(props, properties[i]);
22722736c2fSopenharmony_ci        ret.head[i] = props;
22822736c2fSopenharmony_ci    }
22922736c2fSopenharmony_ci    return ret;
23022736c2fSopenharmony_ci}
23122736c2fSopenharmony_ci
23222736c2fSopenharmony_ciRetInputMethodProperty FfiInputMethodSettingGetAllInputMethods()
23322736c2fSopenharmony_ci{
23422736c2fSopenharmony_ci    IMSA_HILOGD("run in");
23522736c2fSopenharmony_ci    RetInputMethodProperty ret{};
23622736c2fSopenharmony_ci    std::vector<Property> properties;
23722736c2fSopenharmony_ci    auto ctrl = InputMethodController::GetInstance();
23822736c2fSopenharmony_ci    if (ctrl == nullptr) {
23922736c2fSopenharmony_ci        ret.code = ERR_NO_MEMORY;
24022736c2fSopenharmony_ci        return ret;
24122736c2fSopenharmony_ci    }
24222736c2fSopenharmony_ci    int32_t errCode = ctrl->ListInputMethod(properties);
24322736c2fSopenharmony_ci    ret.code = errCode;
24422736c2fSopenharmony_ci    if (errCode != ErrorCode::NO_ERROR) {
24522736c2fSopenharmony_ci        return ret;
24622736c2fSopenharmony_ci    }
24722736c2fSopenharmony_ci    ret.size = static_cast<int64_t>(properties.size());
24822736c2fSopenharmony_ci    if (ret.size > 0) {
24922736c2fSopenharmony_ci        ret.head = static_cast<CInputMethodProperty *>(malloc(sizeof(CInputMethodProperty) * ret.size));
25022736c2fSopenharmony_ci    }
25122736c2fSopenharmony_ci    if (ret.head == nullptr) {
25222736c2fSopenharmony_ci        ret.size = 0;
25322736c2fSopenharmony_ci        return ret;
25422736c2fSopenharmony_ci    }
25522736c2fSopenharmony_ci    for (unsigned int i = 0; i < ret.size; i++) {
25622736c2fSopenharmony_ci        CInputMethodProperty props;
25722736c2fSopenharmony_ci        Utils::InputMethodProperty2C(props, properties[i]);
25822736c2fSopenharmony_ci        ret.head[i] = props;
25922736c2fSopenharmony_ci    }
26022736c2fSopenharmony_ci    return ret;
26122736c2fSopenharmony_ci}
26222736c2fSopenharmony_ci
26322736c2fSopenharmony_ciint32_t FfiInputMethodSettingOn(uint32_t type, void (*func)(CInputMethodProperty, CInputMethodSubtype))
26422736c2fSopenharmony_ci{
26522736c2fSopenharmony_ci    auto setting = CJGetInputMethodSetting::GetIMSInstance();
26622736c2fSopenharmony_ci    if (setting == nullptr) {
26722736c2fSopenharmony_ci        return ERR_NO_MEMORY;
26822736c2fSopenharmony_ci    }
26922736c2fSopenharmony_ci    return setting->Subscribe(type, func);
27022736c2fSopenharmony_ci}
27122736c2fSopenharmony_ci
27222736c2fSopenharmony_ciint32_t FfiInputMethodSettingOff(uint32_t type)
27322736c2fSopenharmony_ci{
27422736c2fSopenharmony_ci    auto setting = CJGetInputMethodSetting::GetIMSInstance();
27522736c2fSopenharmony_ci    if (setting == nullptr) {
27622736c2fSopenharmony_ci        return ERR_NO_MEMORY;
27722736c2fSopenharmony_ci    }
27822736c2fSopenharmony_ci    return setting->UnSubscribe(type);
27922736c2fSopenharmony_ci}
28022736c2fSopenharmony_ci
28122736c2fSopenharmony_ciint32_t FfiInputMethodSettingShowOptionalInputMethods(bool& result)
28222736c2fSopenharmony_ci{
28322736c2fSopenharmony_ci    IMSA_HILOGD("start JsGetInputMethodSetting.");
28422736c2fSopenharmony_ci    auto ctrl = InputMethodController::GetInstance();
28522736c2fSopenharmony_ci    if (ctrl == nullptr) {
28622736c2fSopenharmony_ci        return ERR_NO_MEMORY;
28722736c2fSopenharmony_ci    }
28822736c2fSopenharmony_ci    int32_t errCode = ctrl->DisplayOptionalInputMethod();
28922736c2fSopenharmony_ci    if (errCode == ErrorCode::NO_ERROR) {
29022736c2fSopenharmony_ci        IMSA_HILOGI("exec DisplayOptionalInputMethod success");
29122736c2fSopenharmony_ci        result = true;
29222736c2fSopenharmony_ci    }
29322736c2fSopenharmony_ci    return errCode;
29422736c2fSopenharmony_ci}
29522736c2fSopenharmony_ci
29622736c2fSopenharmony_ciint32_t FfiInputMethodControllerOn(int8_t type, int64_t id)
29722736c2fSopenharmony_ci{
29822736c2fSopenharmony_ci    return CjInputMethodController::Subscribe(type, id);
29922736c2fSopenharmony_ci}
30022736c2fSopenharmony_ci
30122736c2fSopenharmony_ciint32_t FfiInputMethodControllerOff(int8_t type)
30222736c2fSopenharmony_ci{
30322736c2fSopenharmony_ci    return CjInputMethodController::Unsubscribe(type);
30422736c2fSopenharmony_ci}
30522736c2fSopenharmony_ci
30622736c2fSopenharmony_ciint32_t FfiInputMethodControllerAttach(bool showKeyboard, CTextConfig txtCfg)
30722736c2fSopenharmony_ci{
30822736c2fSopenharmony_ci    return CjInputMethodController::Attach(txtCfg, showKeyboard);
30922736c2fSopenharmony_ci}
31022736c2fSopenharmony_ci
31122736c2fSopenharmony_ciint32_t FfiInputMethodControllerDetach()
31222736c2fSopenharmony_ci{
31322736c2fSopenharmony_ci    return CjInputMethodController::Detach();
31422736c2fSopenharmony_ci}
31522736c2fSopenharmony_ci
31622736c2fSopenharmony_ciint32_t FfiInputMethodControllerShowTextInput()
31722736c2fSopenharmony_ci{
31822736c2fSopenharmony_ci    return CjInputMethodController::ShowTextInput();
31922736c2fSopenharmony_ci}
32022736c2fSopenharmony_ci
32122736c2fSopenharmony_ciint32_t FfiInputMethodControllerHideTextInput()
32222736c2fSopenharmony_ci{
32322736c2fSopenharmony_ci    return CjInputMethodController::HideTextInput();
32422736c2fSopenharmony_ci}
32522736c2fSopenharmony_ci
32622736c2fSopenharmony_ciint32_t FfiInputMethodControllerSetCallingWindow(uint32_t windowId)
32722736c2fSopenharmony_ci{
32822736c2fSopenharmony_ci    return CjInputMethodController::SetCallingWindow(windowId);
32922736c2fSopenharmony_ci}
33022736c2fSopenharmony_ci
33122736c2fSopenharmony_ciint32_t FfiInputMethodControllerUpdateCursor(CCursorInfo cursor)
33222736c2fSopenharmony_ci{
33322736c2fSopenharmony_ci    return CjInputMethodController::UpdateCursor(cursor);
33422736c2fSopenharmony_ci}
33522736c2fSopenharmony_ci
33622736c2fSopenharmony_ciint32_t FfiInputMethodControllerChangeSelection(char *text, int32_t start, int32_t end)
33722736c2fSopenharmony_ci{
33822736c2fSopenharmony_ci    return CjInputMethodController::ChangeSelection(std::string(text), start, end);
33922736c2fSopenharmony_ci}
34022736c2fSopenharmony_ci
34122736c2fSopenharmony_ciint32_t FfiInputMethodControllerUpdateAttribute(CInputAttribute inputAttribute)
34222736c2fSopenharmony_ci{
34322736c2fSopenharmony_ci    return CjInputMethodController::UpdateAttribute(inputAttribute);
34422736c2fSopenharmony_ci}
34522736c2fSopenharmony_ci
34622736c2fSopenharmony_ciint32_t FfiInputMethodControllerShowSoftKeyboard()
34722736c2fSopenharmony_ci{
34822736c2fSopenharmony_ci    return CjInputMethodController::ShowSoftKeyboard();
34922736c2fSopenharmony_ci}
35022736c2fSopenharmony_ci
35122736c2fSopenharmony_ciint32_t FfiInputMethodControllerHideSoftKeyboard()
35222736c2fSopenharmony_ci{
35322736c2fSopenharmony_ci    return CjInputMethodController::HideSoftKeyboard();
35422736c2fSopenharmony_ci}
35522736c2fSopenharmony_ci
35622736c2fSopenharmony_ciint32_t FfiInputMethodControllerStopInputSession()
35722736c2fSopenharmony_ci{
35822736c2fSopenharmony_ci    return CjInputMethodController::StopInputSession();
35922736c2fSopenharmony_ci}
36022736c2fSopenharmony_ci}
36122736c2fSopenharmony_ci}