mirror of
https://github.com/openharmony/miscservices_inputmethod.git
synced 2026-07-22 16:35:29 -04:00
fix switchinputmethod
Signed-off-by: zhaolinglan <zhaolinglan@huawei.com>
This commit is contained in:
@@ -75,7 +75,7 @@ namespace MiscServices {
|
||||
int32_t GetInputPattern();
|
||||
void HideCurrentInput();
|
||||
void SetCallingWindow(uint32_t windowId);
|
||||
int32_t SwitchInputMethod(InputMethodProperty *target);
|
||||
int32_t SwitchInputMethod(const InputMethodProperty &target);
|
||||
|
||||
private:
|
||||
InputMethodController();
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace MiscServices {
|
||||
int32_t listInputMethodEnabled(std::vector<InputMethodProperty*> *properties) override;
|
||||
int32_t listInputMethod(std::vector<InputMethodProperty*> *properties) override;
|
||||
int32_t listKeyboardType(const std::u16string& imeId, std::vector<KeyboardType*> *types) override;
|
||||
int32_t SwitchInputMethod(InputMethodProperty* target);
|
||||
int32_t SwitchInputMethod(const InputMethodProperty &target);
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<InputMethodSystemAbilityProxy> delegator_;
|
||||
|
||||
@@ -470,7 +470,7 @@ using namespace MessageID;
|
||||
agent->SetCallingWindow(windowId);
|
||||
}
|
||||
|
||||
int32_t InputMethodController::SwitchInputMethod(InputMethodProperty *target)
|
||||
int32_t InputMethodController::SwitchInputMethod(const InputMethodProperty &target)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodController::SwitchInputMethod");
|
||||
if (!mImms) {
|
||||
|
||||
@@ -438,23 +438,24 @@ namespace MiscServices {
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::SwitchInputMethod(InputMethodProperty* target)
|
||||
int32_t InputMethodSystemAbilityProxy::SwitchInputMethod(const InputMethodProperty &target)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::switchInputMethod");
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::SwitchInputMethod");
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return false;
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
if (!target->Marshalling(data)) {
|
||||
if (!target.Marshalling(data)) {
|
||||
IMSA_HILOGE("InputMethodSystemAbilityProxy::switchInputMethod Failed to marshall target to data!");
|
||||
delete target;
|
||||
return false;
|
||||
return ERROR_IME_PROPERTY_MARSHALL;
|
||||
}
|
||||
delete target;
|
||||
auto ret = Remote()->SendRequest(SWITCH_INPUT_METHOD, data, reply, option);
|
||||
if (ret != 0) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
ret = reply.ReadInt32();
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user