mirror of
https://gitee.com/openharmony/inputmethod_imf
synced 2024-11-23 06:40:06 +00:00
mod
Signed-off-by: cy7717 <chenyu301@huawei.com>
This commit is contained in:
parent
26ec5fdd30
commit
d8bafcc78a
@ -120,6 +120,7 @@ bool ITypesUtil::Unmarshalling(sptr<IRemoteObject> &output, MessageParcel &data)
|
||||
output = data.ReadRemoteObject();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ITypesUtil::Marshalling(const Property &input, MessageParcel &data)
|
||||
{
|
||||
if (!Marshal(data, input.name, input.id, input.label, input.labelId, input.icon, input.iconId)) {
|
||||
@ -248,7 +249,7 @@ bool ITypesUtil::Unmarshalling(TextTotalConfig &output, MessageParcel &data)
|
||||
bool ITypesUtil::Marshalling(const InputClientInfo &input, MessageParcel &data)
|
||||
{
|
||||
if (!Marshal(data, input.pid, input.uid, input.userID, input.isShowKeyboard, input.eventFlag, input.config,
|
||||
input.state, input.isNotifyInputStart, input.client->AsObject(), input.channel->AsObject())) {
|
||||
input.state, input.isNotifyInputStart)) {
|
||||
IMSA_HILOGE("write InputClientInfo to message parcel failed");
|
||||
return false;
|
||||
}
|
||||
@ -262,14 +263,6 @@ bool ITypesUtil::Unmarshalling(InputClientInfo &output, MessageParcel &data)
|
||||
IMSA_HILOGE("read InputClientInfo from message parcel failed");
|
||||
return false;
|
||||
}
|
||||
auto client = data.ReadRemoteObject();
|
||||
auto channel = data.ReadRemoteObject();
|
||||
if (client == nullptr || channel == nullptr) {
|
||||
IMSA_HILOGE("read remote object failed");
|
||||
return false;
|
||||
}
|
||||
output.client = iface_cast<IInputClient>(client);
|
||||
output.channel = iface_cast<IInputDataChannel>(channel);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,6 @@ ohos_shared_library("inputmethod") {
|
||||
"c_utils:utils",
|
||||
"eventhandler:libeventhandler",
|
||||
"hilog:libhilog",
|
||||
"ipc:ipc_single",
|
||||
"input:libmmi-client",
|
||||
"napi:ace_napi",
|
||||
]
|
||||
|
@ -18,8 +18,6 @@
|
||||
|
||||
#include "global.h"
|
||||
#include "i_input_control_channel.h"
|
||||
#include "i_input_data_channel.h"
|
||||
#include "i_system_cmd_channel.h"
|
||||
#include "input_attribute.h"
|
||||
#include "input_client_info.h"
|
||||
#include "input_method_property.h"
|
||||
@ -54,7 +52,7 @@ public:
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.miscservices.inputmethod.IInputMethodCore");
|
||||
|
||||
virtual int32_t StartInput(const InputClientInfo &clientInfo, bool isBindFromClient) = 0;
|
||||
virtual int32_t StopInput(const sptr<IInputDataChannel> &channel) = 0;
|
||||
virtual int32_t StopInput(const sptr<IRemoteObject> &channel) = 0;
|
||||
virtual int32_t ShowKeyboard() = 0;
|
||||
virtual int32_t HideKeyboard() = 0;
|
||||
virtual int32_t InitInputControlChannel(const sptr<IInputControlChannel> &inputControlChannel) = 0;
|
||||
@ -63,8 +61,8 @@ public:
|
||||
virtual bool IsEnable() = 0;
|
||||
virtual int32_t IsPanelShown(const PanelInfo &panelInfo, bool &isShown) = 0;
|
||||
virtual int32_t OnSecurityChange(int32_t security) = 0 ;
|
||||
virtual int32_t OnConnectSystemCmd(const sptr<ISystemCmdChannel> &channel, sptr<IRemoteObject> &agent) = 0 ;
|
||||
virtual void OnClientInactive(const sptr<IInputDataChannel> &channel) = 0;
|
||||
virtual int32_t OnConnectSystemCmd(const sptr<IRemoteObject> &channel, sptr<IRemoteObject> &agent) = 0 ;
|
||||
virtual void OnClientInactive(const sptr<IRemoteObject> &channel) = 0;
|
||||
};
|
||||
} // namespace MiscServices
|
||||
} // namespace OHOS
|
||||
|
@ -160,7 +160,7 @@ private:
|
||||
|
||||
sptr<IInputMethodCore> coreStub_{ nullptr };
|
||||
sptr<IInputMethodAgent> agentStub_{ nullptr };
|
||||
sptr<IInputMethodAgentStub> systemAgentStub_{ nullptr };
|
||||
sptr<IInputMethodAgent> systemAgentStub_{ nullptr };
|
||||
std::mutex imeCheckMutex_;
|
||||
bool isCurrentIme_ = false;
|
||||
|
||||
|
@ -16,8 +16,6 @@
|
||||
#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_CORE_PROXY_H
|
||||
#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_CORE_PROXY_H
|
||||
|
||||
#include "i_input_control_channel.h"
|
||||
#include "i_input_data_channel.h"
|
||||
#include "i_input_method_core.h"
|
||||
#include "input_attribute.h"
|
||||
#include "input_method_property.h"
|
||||
@ -36,7 +34,7 @@ public:
|
||||
DISALLOW_COPY_AND_MOVE(InputMethodCoreProxy);
|
||||
|
||||
int32_t StartInput(const InputClientInfo &clientInfo, bool isBindFromClient) override;
|
||||
int32_t StopInput(const sptr<IInputDataChannel> &channel) override;
|
||||
int32_t StopInput(const sptr<IRemoteObject> &channel) override;
|
||||
int32_t ShowKeyboard() override;
|
||||
int32_t HideKeyboard() override;
|
||||
int32_t InitInputControlChannel(const sptr<IInputControlChannel> &inputControlChannel) override;
|
||||
@ -45,8 +43,8 @@ public:
|
||||
bool IsEnable() override;
|
||||
int32_t IsPanelShown(const PanelInfo &panelInfo, bool &isShown) override;
|
||||
int32_t OnSecurityChange(int32_t security) override;
|
||||
int32_t OnConnectSystemCmd(const sptr<ISystemCmdChannel> &channel, sptr<IRemoteObject> &agent) override;
|
||||
void OnClientInactive(const sptr<IInputDataChannel> &channel) override;
|
||||
int32_t OnConnectSystemCmd(const sptr<IRemoteObject> &channel, sptr<IRemoteObject> &agent) override;
|
||||
void OnClientInactive(const sptr<IRemoteObject> &channel) override;
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<InputMethodCoreProxy> delegator_;
|
||||
|
@ -20,9 +20,6 @@
|
||||
#include <cstdint>
|
||||
#include <mutex>
|
||||
|
||||
#include "i_input_control_channel.h"
|
||||
#include "i_input_data_channel.h"
|
||||
#include "i_input_method_agent.h"
|
||||
#include "i_input_method_core.h"
|
||||
#include "input_attribute.h"
|
||||
#include "iremote_broker.h"
|
||||
@ -39,7 +36,7 @@ public:
|
||||
virtual ~InputMethodCoreStub();
|
||||
int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
|
||||
int32_t StartInput(const InputClientInfo &clientInfo, bool isBindFromClient) override;
|
||||
int32_t StopInput(const sptr<IInputDataChannel> &channel) override;
|
||||
int32_t StopInput(const sptr<IRemoteObject> &channel) override;
|
||||
int32_t ShowKeyboard() override;
|
||||
int32_t HideKeyboard() override;
|
||||
int32_t InitInputControlChannel(const sptr<IInputControlChannel> &inputControlChannel) override;
|
||||
@ -48,8 +45,8 @@ public:
|
||||
bool IsEnable() override;
|
||||
int32_t IsPanelShown(const PanelInfo &panelInfo, bool &isShown) override;
|
||||
int32_t OnSecurityChange(int32_t security) override;
|
||||
int32_t OnConnectSystemCmd(const sptr<ISystemCmdChannel> &channel, sptr<IRemoteObject> &agent) override;
|
||||
void OnClientInactive(const sptr<IInputDataChannel> &channel) override;
|
||||
int32_t OnConnectSystemCmd(const sptr<IRemoteObject> &channel, sptr<IRemoteObject> &agent) override;
|
||||
void OnClientInactive(const sptr<IRemoteObject> &channel) override;
|
||||
void SetMessageHandler(MessageHandler *msgHandler);
|
||||
|
||||
private:
|
||||
|
@ -119,7 +119,7 @@ int32_t InputMethodAbility::SetCoreAndAgent()
|
||||
IMSA_HILOGE("imsa proxy is nullptr");
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
int32_t ret = proxy->SetCoreAndAgent(coreStub_, agentStub_);
|
||||
int32_t ret = proxy->SetCoreAndAgent(coreStub_, agentStub_->AsObject());
|
||||
if (ret != ErrorCode::NO_ERROR) {
|
||||
IMSA_HILOGE("set failed, ret: %{public}d", ret);
|
||||
return ret;
|
||||
@ -143,12 +143,12 @@ int32_t InputMethodAbility::UnRegisteredProxyIme(UnRegisteredType type)
|
||||
void InputMethodAbility::Initialize()
|
||||
{
|
||||
IMSA_HILOGD("IMA");
|
||||
auto coreStub = new (std::nothrow) InputMethodCoreStub();
|
||||
sptr<InputMethodCoreStub> coreStub = new (std::nothrow) InputMethodCoreStub();
|
||||
if (coreStub == nullptr) {
|
||||
IMSA_HILOGE("failed to create core");
|
||||
return;
|
||||
}
|
||||
auto agentStub = new (std::nothrow) InputMethodAgentStub();
|
||||
sptr<InputMethodAgentStub> agentStub = new (std::nothrow) InputMethodAgentStub();
|
||||
if (agentStub == nullptr) {
|
||||
IMSA_HILOGE("failed to create agent");
|
||||
return;
|
||||
@ -235,13 +235,13 @@ void InputMethodAbility::OnInitInputControlChannel(Message *msg)
|
||||
|
||||
int32_t InputMethodAbility::StartInput(const InputClientInfo &clientInfo, bool isBindFromClient)
|
||||
{
|
||||
if (clientInfo.channel->AsObject() == nullptr) {
|
||||
if (clientInfo.channel == nullptr) {
|
||||
IMSA_HILOGE("channelObject is nullptr");
|
||||
return ErrorCode::ERROR_CLIENT_NULL_POINTER;
|
||||
}
|
||||
IMSA_HILOGI(
|
||||
"IMA isShowKeyboard: %{public}d, isBindFromClient: %{public}d", clientInfo.isShowKeyboard, isBindFromClient);
|
||||
SetInputDataChannel(clientInfo.channel->AsObject());
|
||||
SetInputDataChannel(clientInfo.channel);
|
||||
isBindFromClient ? InvokeTextChangeCallback(clientInfo.config) : NotifyAllTextConfig();
|
||||
SetInputAttribute(clientInfo.config.inputAttribute);
|
||||
if (imeListener_ == nullptr) {
|
||||
|
@ -42,7 +42,7 @@ int32_t InputMethodCoreProxy::StartInput(const InputClientInfo &clientInfo, bool
|
||||
{
|
||||
IMSA_HILOGI("CoreProxy");
|
||||
return SendRequest(START_INPUT, [&clientInfo, isBindFromClient](MessageParcel &data) {
|
||||
return ITypesUtil::Marshal(data, isBindFromClient, clientInfo);
|
||||
return ITypesUtil::Marshal(data, isBindFromClient, clientInfo, clientInfo.channel);
|
||||
});
|
||||
}
|
||||
|
||||
@ -53,13 +53,11 @@ int32_t InputMethodCoreProxy::OnSecurityChange(int32_t security)
|
||||
});
|
||||
}
|
||||
|
||||
int32_t InputMethodCoreProxy::OnConnectSystemCmd(const sptr<ISystemCmdChannel> &channel, sptr<IRemoteObject> &agent)
|
||||
int32_t InputMethodCoreProxy::OnConnectSystemCmd(const sptr<IRemoteObject> &channel, sptr<IRemoteObject> &agent)
|
||||
{
|
||||
return SendRequest(ON_CONNECT_SYSTEM_CMD, [channel](MessageParcel& data) {
|
||||
return data.WriteRemoteObject(channel->AsObject());
|
||||
}, [&agent](MessageParcel &reply) {
|
||||
return ITypesUtil::Unmarshal(reply, agent);
|
||||
});
|
||||
return SendRequest(
|
||||
ON_CONNECT_SYSTEM_CMD, [channel](MessageParcel &data) { return data.WriteRemoteObject(channel); },
|
||||
[&agent](MessageParcel &reply) { return ITypesUtil::Unmarshal(reply, agent); });
|
||||
}
|
||||
|
||||
void InputMethodCoreProxy::StopInputService(bool isTerminateIme)
|
||||
@ -83,10 +81,9 @@ int32_t InputMethodCoreProxy::SetSubtype(const SubProperty &property)
|
||||
return SendRequest(SET_SUBTYPE, [&property](MessageParcel &data) { return ITypesUtil::Marshal(data, property); });
|
||||
}
|
||||
|
||||
int32_t InputMethodCoreProxy::StopInput(const sptr<IInputDataChannel> &channel)
|
||||
int32_t InputMethodCoreProxy::StopInput(const sptr<IRemoteObject> &channel)
|
||||
{
|
||||
return SendRequest(
|
||||
STOP_INPUT, [&channel](MessageParcel &data) { return ITypesUtil::Marshal(data, channel->AsObject()); });
|
||||
return SendRequest(STOP_INPUT, [&channel](MessageParcel &data) { return ITypesUtil::Marshal(data, channel); });
|
||||
}
|
||||
|
||||
bool InputMethodCoreProxy::IsEnable()
|
||||
@ -104,11 +101,11 @@ int32_t InputMethodCoreProxy::IsPanelShown(const PanelInfo &panelInfo, bool &isS
|
||||
[&isShown](MessageParcel &reply) { return ITypesUtil::Unmarshal(reply, isShown); });
|
||||
}
|
||||
|
||||
void InputMethodCoreProxy::OnClientInactive(const sptr<IInputDataChannel> &channel)
|
||||
void InputMethodCoreProxy::OnClientInactive(const sptr<IRemoteObject> &channel)
|
||||
{
|
||||
SendRequest(
|
||||
ON_CLIENT_INACTIVE, [&channel](MessageParcel &data) { return ITypesUtil::Marshal(data, channel->AsObject()); },
|
||||
nullptr, MessageOption::TF_ASYNC);
|
||||
ON_CLIENT_INACTIVE, [&channel](MessageParcel &data) { return ITypesUtil::Marshal(data, channel); }, nullptr,
|
||||
MessageOption::TF_ASYNC);
|
||||
}
|
||||
|
||||
int32_t InputMethodCoreProxy::SendRequest(int code, ParcelHandler input, ParcelHandler output, MessageOption option)
|
||||
|
@ -106,7 +106,8 @@ int32_t InputMethodCoreStub::StartInputOnRemote(MessageParcel &data, MessageParc
|
||||
"CoreStub, callingPid/Uid: %{public}d/%{public}d", IPCSkeleton::GetCallingPid(), IPCSkeleton::GetCallingUid());
|
||||
bool isBindFromClient = false;
|
||||
InputClientInfo clientInfo = {};
|
||||
if (!ITypesUtil::Unmarshal(data, isBindFromClient, clientInfo)) {
|
||||
sptr<IRemoteObject> channel = nullptr;
|
||||
if (!ITypesUtil::Unmarshal(data, isBindFromClient, clientInfo, clientInfo.channel)) {
|
||||
IMSA_HILOGE("Unmarshal failed.");
|
||||
return ErrorCode::ERROR_EX_PARCELABLE;
|
||||
}
|
||||
@ -125,7 +126,7 @@ int32_t InputMethodCoreStub::SecurityChangeOnRemote(MessageParcel &data, Message
|
||||
return ITypesUtil::Marshal(reply, ret) ? ErrorCode::NO_ERROR : ErrorCode::ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
int32_t InputMethodCoreStub::OnConnectSystemCmd(const sptr<ISystemCmdChannel> &channel, sptr<IRemoteObject> &agent)
|
||||
int32_t InputMethodCoreStub::OnConnectSystemCmd(const sptr<IRemoteObject> &channel, sptr<IRemoteObject> &agent)
|
||||
{
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
@ -231,7 +232,7 @@ int32_t InputMethodCoreStub::OnSecurityChange(int32_t security)
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t InputMethodCoreStub::StopInput(const sptr<IInputDataChannel> &channel)
|
||||
int32_t InputMethodCoreStub::StopInput(const sptr<IRemoteObject> &channel)
|
||||
{
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
@ -246,7 +247,7 @@ int32_t InputMethodCoreStub::IsPanelShown(const PanelInfo &panelInfo, bool &isSh
|
||||
return InputMethodAbility::GetInstance()->IsPanelShown(panelInfo, isShown);
|
||||
}
|
||||
|
||||
void InputMethodCoreStub::OnClientInactive(const sptr<IInputDataChannel> &channel)
|
||||
void InputMethodCoreStub::OnClientInactive(const sptr<IRemoteObject> &channel)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public:
|
||||
|
||||
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.miscservices.inputmethod.InputClient");
|
||||
|
||||
virtual int32_t OnInputReady(const sptr<IInputMethodAgent> &agent) = 0;
|
||||
virtual int32_t OnInputReady(const sptr<IRemoteObject> &agent) = 0;
|
||||
virtual int32_t OnInputStop() = 0;
|
||||
virtual int32_t OnSwitchInput(const Property &property, const SubProperty &subProperty) = 0;
|
||||
virtual int32_t OnPanelStatusChange(const InputWindowStatus &status, const ImeWindowInfo &info) = 0;
|
||||
|
@ -37,7 +37,7 @@ struct InputClientInfo {
|
||||
uint32_t eventFlag{ NO_EVENT_ON }; // the flag of the all listen event
|
||||
InputAttribute attribute; // the input client attribute
|
||||
sptr<IInputClient> client{ nullptr }; // the remote object handler for service to callback input client
|
||||
sptr<IInputDataChannel> channel{ nullptr }; // the remote object handler for ime to callback input client
|
||||
sptr<IRemoteObject> channel{ nullptr }; // the remote object handler for ime to callback input client
|
||||
sptr<InputDeathRecipient> deathRecipient{ nullptr }; // death recipient of client
|
||||
ClientState state{ ClientState::INACTIVE }; // the state of input client
|
||||
bool isNotifyInputStart { true };
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <functional>
|
||||
|
||||
#include "i_input_client.h"
|
||||
#include "i_input_method_agent.h"
|
||||
#include "iremote_broker.h"
|
||||
#include "iremote_object.h"
|
||||
#include "iremote_proxy.h"
|
||||
@ -35,7 +34,7 @@ public:
|
||||
~InputClientProxy() = default;
|
||||
DISALLOW_COPY_AND_MOVE(InputClientProxy);
|
||||
|
||||
int32_t OnInputReady(const sptr<IInputMethodAgent> &agent) override;
|
||||
int32_t OnInputReady(const sptr<IRemoteObject> &agent) override;
|
||||
int32_t OnInputStop() override;
|
||||
int32_t OnSwitchInput(const Property &property, const SubProperty &subProperty) override;
|
||||
int32_t OnPanelStatusChange(const InputWindowStatus &status, const ImeWindowInfo &info) override;
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <cstdint>
|
||||
|
||||
#include "i_input_client.h"
|
||||
#include "i_input_method_agent.h"
|
||||
#include "ime_event_monitor_manager.h"
|
||||
#include "iremote_stub.h"
|
||||
#include "message_handler.h"
|
||||
@ -37,7 +36,7 @@ public:
|
||||
InputClientStub();
|
||||
~InputClientStub();
|
||||
|
||||
int32_t OnInputReady(const sptr<IInputMethodAgent> &agent) override;
|
||||
int32_t OnInputReady(const sptr<IRemoteObject> &agent) override;
|
||||
int32_t OnInputStop() override;
|
||||
int32_t OnSwitchInput(const Property &property, const SubProperty &subProperty) override;
|
||||
int32_t OnPanelStatusChange(const InputWindowStatus &status, const ImeWindowInfo &info) override;
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
int32_t ListInputMethod(InputMethodStatus status, std::vector<Property> &props) override;
|
||||
int32_t SwitchInputMethod(const std::string &name, const std::string &subName, SwitchTrigger trigger) override;
|
||||
int32_t DisplayOptionalInputMethod() override;
|
||||
int32_t SetCoreAndAgent(const sptr<IInputMethodCore> &core, const sptr<IInputMethodAgent> &agent) override;
|
||||
int32_t SetCoreAndAgent(const sptr<IInputMethodCore> &core, const sptr<IRemoteObject> &agent) override;
|
||||
int32_t UnRegisteredProxyIme(UnRegisteredType type, const sptr<IInputMethodCore> &core) override;
|
||||
int32_t ListCurrentInputMethodSubtype(std::vector<SubProperty> &subProps) override;
|
||||
int32_t ListInputMethodSubtype(const std::string &name, std::vector<SubProperty> &subProps) override;
|
||||
@ -73,7 +73,7 @@ public:
|
||||
int32_t IsPanelShown(const PanelInfo &panelInfo, bool &isShown) override;
|
||||
int32_t GetSecurityMode(int32_t &security) override;
|
||||
int32_t IsDefaultIme() override;
|
||||
int32_t ConnectSystemCmd(const sptr<ISystemCmdChannel> &channel, sptr<IRemoteObject> &agent) override;
|
||||
int32_t ConnectSystemCmd(const sptr<IRemoteObject> &channel, sptr<IRemoteObject> &agent) override;
|
||||
// Deprecated because of no permission check, kept for compatibility
|
||||
int32_t HideCurrentInputDeprecated() override;
|
||||
int32_t ShowCurrentInputDeprecated() override;
|
||||
|
@ -27,10 +27,9 @@ InputClientProxy::InputClientProxy(const sptr<IRemoteObject> &object) : IRemoteP
|
||||
{
|
||||
}
|
||||
|
||||
int32_t InputClientProxy::OnInputReady(const sptr<IInputMethodAgent> &agent)
|
||||
int32_t InputClientProxy::OnInputReady(const sptr<IRemoteObject> &agent)
|
||||
{
|
||||
return SendRequest(
|
||||
ON_INPUT_READY, [agent](MessageParcel &data) { return ITypesUtil::Marshal(data, agent->AsObject()); });
|
||||
return SendRequest(ON_INPUT_READY, [agent](MessageParcel &data) { return ITypesUtil::Marshal(data, agent); });
|
||||
}
|
||||
|
||||
int32_t InputClientProxy::OnInputStop()
|
||||
|
@ -110,7 +110,7 @@ int32_t InputClientStub::DeactivateClientOnRemote(MessageParcel &data, MessagePa
|
||||
return reply.WriteInt32(ErrorCode::NO_ERROR) ? ErrorCode::NO_ERROR : ErrorCode::ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
int32_t InputClientStub::OnInputReady(const sptr<IInputMethodAgent> &agent)
|
||||
int32_t InputClientStub::OnInputReady(const sptr<IRemoteObject> &agent)
|
||||
{
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
|
@ -115,19 +115,18 @@ void InputMethodController::SetControllerListener(std::shared_ptr<ControllerList
|
||||
|
||||
int32_t InputMethodController::Initialize()
|
||||
{
|
||||
auto client = new (std::nothrow) InputClientStub();
|
||||
sptr<IInputClient> client = new (std::nothrow) InputClientStub();
|
||||
if (client == nullptr) {
|
||||
IMSA_HILOGE("failed to new client");
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
auto channel = new (std::nothrow) InputDataChannelStub();
|
||||
sptr<IInputDataChannel> channel = new (std::nothrow) InputDataChannelStub();
|
||||
if (channel == nullptr) {
|
||||
delete client;
|
||||
IMSA_HILOGE("failed to new channel");
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
InputAttribute attribute = { .inputPattern = InputAttribute::PATTERN_TEXT };
|
||||
clientInfo_ = { .attribute = attribute, .client = client, .channel = channel };
|
||||
clientInfo_ = { .attribute = attribute, .client = client, .channel = channel->AsObject() };
|
||||
|
||||
// make AppExecFwk::EventHandler handler
|
||||
handler_ = std::make_shared<AppExecFwk::EventHandler>(AppExecFwk::EventRunner::GetMainEventRunner());
|
||||
|
@ -34,22 +34,22 @@ int32_t InputMethodSystemAbilityProxy::StartInput(InputClientInfo &inputClientIn
|
||||
{
|
||||
return SendRequest(
|
||||
static_cast<uint32_t>(InputMethodInterfaceCode::START_INPUT),
|
||||
[&inputClientInfo](MessageParcel &data) { return ITypesUtil::Marshal(data, inputClientInfo); },
|
||||
[&inputClientInfo](MessageParcel &data) {
|
||||
return ITypesUtil::Marshal(
|
||||
data, inputClientInfo, inputClientInfo.client->AsObject(), inputClientInfo.channel);
|
||||
},
|
||||
[&agent](MessageParcel &reply) {
|
||||
agent = reply.ReadRemoteObject();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::ConnectSystemCmd(
|
||||
const sptr<ISystemCmdChannel> &channel, sptr<IRemoteObject> &agent)
|
||||
int32_t InputMethodSystemAbilityProxy::ConnectSystemCmd(const sptr<IRemoteObject> &channel, sptr<IRemoteObject> &agent)
|
||||
{
|
||||
return SendRequest(
|
||||
static_cast<uint32_t>(InputMethodInterfaceCode::CONNECT_SYSTEM_CMD),
|
||||
[channel](MessageParcel &data) { return data.WriteRemoteObject(channel->AsObject()); },
|
||||
[&agent](MessageParcel &reply) {
|
||||
return ITypesUtil::Unmarshal(reply, agent);
|
||||
});
|
||||
[channel](MessageParcel &data) { return data.WriteRemoteObject(channel); },
|
||||
[&agent](MessageParcel &reply) { return ITypesUtil::Unmarshal(reply, agent); });
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::ShowCurrentInput()
|
||||
@ -101,11 +101,11 @@ int32_t InputMethodSystemAbilityProxy::DisplayOptionalInputMethod()
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::SetCoreAndAgent(
|
||||
const sptr<IInputMethodCore> &core, const sptr<IInputMethodAgent> &agent)
|
||||
const sptr<IInputMethodCore> &core, const sptr<IRemoteObject> &agent)
|
||||
{
|
||||
return SendRequest(
|
||||
static_cast<uint32_t>(InputMethodInterfaceCode::SET_CORE_AND_AGENT), [core, agent](MessageParcel &data) {
|
||||
return data.WriteRemoteObject(core->AsObject()) && data.WriteRemoteObject(agent->AsObject());
|
||||
return data.WriteRemoteObject(core->AsObject()) && data.WriteRemoteObject(agent);
|
||||
});
|
||||
}
|
||||
|
||||
@ -215,7 +215,9 @@ int32_t InputMethodSystemAbilityProxy::PanelStatusChange(const InputWindowStatus
|
||||
int32_t InputMethodSystemAbilityProxy::UpdateListenEventFlag(InputClientInfo &clientInfo, uint32_t eventFlag)
|
||||
{
|
||||
return SendRequest(static_cast<uint32_t>(InputMethodInterfaceCode::UPDATE_LISTEN_EVENT_FLAG),
|
||||
[&clientInfo, eventFlag](MessageParcel &data) { return ITypesUtil::Marshal(data, clientInfo, eventFlag); });
|
||||
[&clientInfo, eventFlag](MessageParcel &data) {
|
||||
return ITypesUtil::Marshal(data, clientInfo, clientInfo.client->AsObject(), clientInfo.channel, eventFlag);
|
||||
});
|
||||
}
|
||||
|
||||
bool InputMethodSystemAbilityProxy::IsCurrentIme()
|
||||
|
@ -31,6 +31,7 @@ config("inputmethod_ability_native_public_config") {
|
||||
"include",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_ability/include",
|
||||
"${inputmethod_path}/frameworks/common",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller/include",
|
||||
"${inputmethod_path}/services/include",
|
||||
"${windowmanager_path}/interfaces/innerkits/dm",
|
||||
"${windowmanager_path}/interfaces/innerkits/wm",
|
||||
@ -56,7 +57,6 @@ ohos_shared_library("inputmethod_ability") {
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_system_ability_proxy.cpp",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_controller/src/keyevent_consumer_proxy.cpp",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_controller/src/system_cmd_channel_proxy.cpp",
|
||||
"${inputmethod_path}/services/src/global.cpp",
|
||||
"${inputmethod_path}/services/src/input_control_channel_proxy.cpp",
|
||||
]
|
||||
cflags_cc = [
|
||||
@ -91,3 +91,47 @@ ohos_shared_library("inputmethod_ability") {
|
||||
innerapi_tags = [ "platformsdk" ]
|
||||
part_name = "imf"
|
||||
}
|
||||
|
||||
ohos_static_library("inputmethod_ability_static") {
|
||||
branch_protector_ret = "pac_ret"
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
sources = [
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_ability.cpp",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_ability_interface.cpp",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_ability_utils.cpp",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_agent_stub.cpp",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_core_stub.cpp",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_panel.cpp",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_data_channel_proxy.cpp",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_system_ability_proxy.cpp",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_controller/src/keyevent_consumer_proxy.cpp",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_controller/src/system_cmd_channel_proxy.cpp",
|
||||
"${inputmethod_path}/services/src/input_control_channel_proxy.cpp",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:configuration",
|
||||
"ability_base:want",
|
||||
"ability_runtime:ability_context_native",
|
||||
"c_utils:utils",
|
||||
"graphic_2d:window_animation",
|
||||
"hilog:libhilog",
|
||||
"input:libmmi-client",
|
||||
"ipc:ipc_single",
|
||||
"napi:ace_napi",
|
||||
"samgr:samgr_proxy",
|
||||
"window_manager:libdm",
|
||||
"window_manager:libwm",
|
||||
]
|
||||
|
||||
public_deps = [ "${inputmethod_path}/common:inputmethod_common" ]
|
||||
|
||||
public_configs = [ ":inputmethod_ability_native_public_config" ]
|
||||
|
||||
subsystem_name = "inputmethod"
|
||||
part_name = "imf"
|
||||
}
|
||||
|
@ -58,9 +58,6 @@ ohos_shared_library("inputmethod_client") {
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_method_utils.cpp",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_controller/src/keyevent_consumer_stub.cpp",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_controller/src/system_cmd_channel_stub.cpp",
|
||||
"${inputmethod_path}/services/src/global.cpp",
|
||||
"${inputmethod_path}/services/src/message.cpp",
|
||||
"${inputmethod_path}/services/src/message_handler.cpp",
|
||||
]
|
||||
|
||||
cflags_cc = [
|
||||
|
@ -110,3 +110,77 @@ ohos_shared_library("inputmethod_service") {
|
||||
subsystem_name = "inputmethod"
|
||||
part_name = "imf"
|
||||
}
|
||||
|
||||
ohos_static_library("inputmethod_service_static") {
|
||||
branch_protector_ret = "pac_ret"
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
cflags_cc = [
|
||||
"-fdata-sections",
|
||||
"-ffunction-sections",
|
||||
"-Os",
|
||||
]
|
||||
sources = [
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_core_proxy.cpp",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_controller/src/input_client_proxy.cpp",
|
||||
"${inputmethod_path}/services/adapter/focus_monitor/src/focus_change_listener.cpp",
|
||||
"${inputmethod_path}/services/adapter/focus_monitor/src/focus_monitor_manager.cpp",
|
||||
"${inputmethod_path}/services/adapter/system_language_observer/src/system_language_observer.cpp",
|
||||
"${inputmethod_path}/services/adapter/wms_connection_monitor/src/wms_connection_monitor_manager.cpp",
|
||||
"${inputmethod_path}/services/adapter/wms_connection_monitor/src/wms_connection_observer.cpp",
|
||||
"${inputmethod_path}/services/identity_checker/src/identity_checker_impl.cpp",
|
||||
"src/freeze_manager.cpp",
|
||||
"src/im_common_event_manager.cpp",
|
||||
"src/ime_cfg_manager.cpp",
|
||||
"src/ime_info_inquirer.cpp",
|
||||
"src/input_control_channel_stub.cpp",
|
||||
"src/input_method_system_ability.cpp",
|
||||
"src/input_method_system_ability_stub.cpp",
|
||||
"src/input_type_manager.cpp",
|
||||
"src/peruser_session.cpp",
|
||||
"src/sys_cfg_parser.cpp",
|
||||
]
|
||||
|
||||
public_configs = [ ":inputmethod_services_native_config" ]
|
||||
|
||||
public_deps = [
|
||||
"${inputmethod_path}/services/adapter/keyboard:keboard_event_static",
|
||||
"${inputmethod_path}/services/adapter/settings_data_provider:settings_data_static",
|
||||
"${inputmethod_path}/common:inputmethod_common",
|
||||
"${inputmethod_path}/services/file:imf_file_static",
|
||||
"${inputmethod_path}/services/json:imf_json_static",
|
||||
"//third_party/cJSON:cjson",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"ability_base:want",
|
||||
"ability_runtime:ability_manager",
|
||||
"access_token:libaccesstoken_sdk",
|
||||
"access_token:libtokenid_sdk",
|
||||
"bundle_framework:appexecfwk_base",
|
||||
"bundle_framework:appexecfwk_core",
|
||||
"c_utils:utils",
|
||||
"common_event_service:cesfwk_innerkits",
|
||||
"config_policy:configpolicy_util",
|
||||
"data_share:datashare_common",
|
||||
"data_share:datashare_consumer",
|
||||
"eventhandler:libeventhandler",
|
||||
"hilog:libhilog",
|
||||
"init:libbeget_proxy",
|
||||
"init:libbegetutil",
|
||||
"input:libmmi-client",
|
||||
"ipc:ipc_single",
|
||||
"os_account:os_account_innerkits",
|
||||
"resource_schedule_service:ressched_client",
|
||||
"safwk:system_ability_fwk",
|
||||
"samgr:samgr_proxy",
|
||||
"window_manager:libwm",
|
||||
"window_manager:libwsutils",
|
||||
]
|
||||
|
||||
subsystem_name = "inputmethod"
|
||||
part_name = "imf"
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "event_status_manager.h"
|
||||
#include "global.h"
|
||||
#include "i_input_client.h"
|
||||
#include "i_input_data_channel.h"
|
||||
#include "i_input_method_core.h"
|
||||
#include "i_system_cmd_channel.h"
|
||||
#include "input_attribute.h"
|
||||
@ -59,7 +58,7 @@ public:
|
||||
virtual std::shared_ptr<SubProperty> GetCurrentInputMethodSubtype() = 0;
|
||||
virtual int32_t ListInputMethod(InputMethodStatus status, std::vector<Property> &props) = 0;
|
||||
virtual int32_t DisplayOptionalInputMethod() = 0;
|
||||
virtual int32_t SetCoreAndAgent(const sptr<IInputMethodCore> &core, const sptr<IInputMethodAgent> &agent) = 0;
|
||||
virtual int32_t SetCoreAndAgent(const sptr<IInputMethodCore> &core, const sptr<IRemoteObject> &agent) = 0;
|
||||
virtual int32_t UnRegisteredProxyIme(UnRegisteredType type, const sptr<IInputMethodCore> &core) = 0;
|
||||
virtual int32_t ListCurrentInputMethodSubtype(std::vector<SubProperty> &subProps) = 0;
|
||||
virtual int32_t ListInputMethodSubtype(const std::string &name, std::vector<SubProperty> &subProps) = 0;
|
||||
@ -74,7 +73,7 @@ public:
|
||||
virtual int32_t IsPanelShown(const PanelInfo &panelInfo, bool &isShown) = 0;
|
||||
virtual int32_t GetSecurityMode(int32_t &security) = 0;
|
||||
virtual int32_t IsDefaultIme() = 0;
|
||||
virtual int32_t ConnectSystemCmd(const sptr<ISystemCmdChannel> &channel, sptr<IRemoteObject> &agent) = 0;
|
||||
virtual int32_t ConnectSystemCmd(const sptr<IRemoteObject> &channel, sptr<IRemoteObject> &agent) = 0;
|
||||
|
||||
// Deprecated because of no permission check, and keep for compatibility
|
||||
virtual int32_t HideCurrentInputDeprecated() = 0;
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
int32_t SwitchInputMethod(
|
||||
const std::string &bundleName, const std::string &subName, SwitchTrigger trigger) override;
|
||||
int32_t DisplayOptionalInputMethod() override;
|
||||
int32_t SetCoreAndAgent(const sptr<IInputMethodCore> &core, const sptr<IInputMethodAgent> &agent) override;
|
||||
int32_t SetCoreAndAgent(const sptr<IInputMethodCore> &core, const sptr<IRemoteObject> &agent) override;
|
||||
int32_t UnRegisteredProxyIme(UnRegisteredType type, const sptr<IInputMethodCore> &core) override;
|
||||
int32_t PanelStatusChange(const InputWindowStatus &status, const ImeWindowInfo &info) override;
|
||||
int32_t UpdateListenEventFlag(InputClientInfo &clientInfo, uint32_t eventFlag) override;
|
||||
@ -79,7 +79,7 @@ public:
|
||||
int32_t ExitCurrentInputType() override;
|
||||
int32_t IsPanelShown(const PanelInfo &panelInfo, bool &isShown) override;
|
||||
int32_t GetSecurityMode(int32_t &security) override;
|
||||
int32_t ConnectSystemCmd(const sptr<ISystemCmdChannel> &channel, sptr<IRemoteObject> &agent) override;
|
||||
int32_t ConnectSystemCmd(const sptr<IRemoteObject> &channel, sptr<IRemoteObject> &agent) override;
|
||||
// Deprecated because of no permission check, kept for compatibility
|
||||
int32_t HideCurrentInputDeprecated() override;
|
||||
int32_t ShowCurrentInputDeprecated() override;
|
||||
|
@ -52,10 +52,10 @@ namespace OHOS {
|
||||
namespace MiscServices {
|
||||
struct ImeData {
|
||||
sptr<IInputMethodCore> core{ nullptr };
|
||||
sptr<IInputMethodAgent> agent{ nullptr };
|
||||
sptr<IRemoteObject> agent{ nullptr };
|
||||
sptr<InputDeathRecipient> deathRecipient{ nullptr };
|
||||
std::shared_ptr<FreezeManager> freezeMgr;
|
||||
ImeData(sptr<IInputMethodCore> core, sptr<IInputMethodAgent> agent, sptr<InputDeathRecipient> deathRecipient,
|
||||
ImeData(sptr<IInputMethodCore> core, sptr<IRemoteObject> agent, sptr<InputDeathRecipient> deathRecipient,
|
||||
pid_t imePid)
|
||||
: core(std::move(core)), agent(std::move(agent)), deathRecipient(std::move(deathRecipient)),
|
||||
freezeMgr(std::make_shared<FreezeManager>(imePid))
|
||||
@ -76,7 +76,7 @@ public:
|
||||
int32_t OnPrepareInput(const InputClientInfo &clientInfo);
|
||||
int32_t OnStartInput(const InputClientInfo &inputClientInfo, sptr<IRemoteObject> &agent);
|
||||
int32_t OnReleaseInput(const sptr<IInputClient> &client);
|
||||
int32_t OnSetCoreAndAgent(const sptr<IInputMethodCore> &core, const sptr<IInputMethodAgent> &agent);
|
||||
int32_t OnSetCoreAndAgent(const sptr<IInputMethodCore> &core, const sptr<IRemoteObject> &agent);
|
||||
int32_t OnHideCurrentInput();
|
||||
int32_t OnShowCurrentInput();
|
||||
int32_t OnShowInput(sptr<IInputClient> client);
|
||||
@ -93,7 +93,7 @@ public:
|
||||
int64_t GetCurrentClientPid();
|
||||
int32_t OnPanelStatusChange(const InputWindowStatus &status, const ImeWindowInfo &info);
|
||||
int32_t OnUpdateListenEventFlag(const InputClientInfo &clientInfo);
|
||||
int32_t OnRegisterProxyIme(const sptr<IInputMethodCore> &core, const sptr<IInputMethodAgent> &agent);
|
||||
int32_t OnRegisterProxyIme(const sptr<IInputMethodCore> &core, const sptr<IRemoteObject> &agent);
|
||||
int32_t OnUnRegisteredProxyIme(UnRegisteredType type, const sptr<IInputMethodCore> &core);
|
||||
bool StartCurrentIme(int32_t userId, bool isRetry);
|
||||
void StopCurrentIme();
|
||||
@ -104,7 +104,7 @@ public:
|
||||
int32_t IsPanelShown(const PanelInfo &panelInfo, bool &isShown);
|
||||
bool CheckSecurityMode();
|
||||
bool IsWmsReady();
|
||||
int32_t OnConnectSystemCmd(const sptr<ISystemCmdChannel> &channel, sptr<IRemoteObject> &agent);
|
||||
int32_t OnConnectSystemCmd(const sptr<IRemoteObject> &channel, sptr<IRemoteObject> &agent);
|
||||
|
||||
private:
|
||||
struct ResetManager {
|
||||
@ -145,7 +145,7 @@ private:
|
||||
const std::unordered_map<UpdateFlag, std::variant<bool, uint32_t, ImeType, ClientState, TextTotalConfig>>
|
||||
&updateInfos);
|
||||
|
||||
int32_t AddImeData(ImeType type, sptr<IInputMethodCore> core, sptr<IInputMethodAgent> agent, pid_t pid);
|
||||
int32_t AddImeData(ImeType type, sptr<IInputMethodCore> core, sptr<IRemoteObject> agent, pid_t pid);
|
||||
void RemoveImeData(ImeType type, bool isImeDied);
|
||||
int32_t RemoveIme(const sptr<IInputMethodCore> &core, ImeType type);
|
||||
std::shared_ptr<ImeData> GetImeData(ImeType type);
|
||||
@ -156,7 +156,7 @@ private:
|
||||
void UnBindClientWithIme(
|
||||
const std::shared_ptr<InputClientInfo> ¤tClientInfo, bool isUnbindFromClient = false);
|
||||
void StopClientInput(const sptr<IInputClient> ¤tClient);
|
||||
void StopImeInput(ImeType currentType, const sptr<IInputDataChannel> ¤tChannel);
|
||||
void StopImeInput(ImeType currentType, const sptr<IRemoteObject> ¤tChannel);
|
||||
|
||||
int32_t HideKeyboard(const sptr<IInputClient> ¤tClient);
|
||||
int32_t ShowKeyboard(const sptr<IInputClient> ¤tClient);
|
||||
|
@ -271,6 +271,7 @@ int32_t InputMethodSystemAbility::PrepareInput(InputClientInfo &clientInfo)
|
||||
int32_t InputMethodSystemAbility::GenerateClientInfo(InputClientInfo &clientInfo)
|
||||
{
|
||||
if (clientInfo.client == nullptr || clientInfo.channel == nullptr) {
|
||||
IMSA_HILOGE("client or channel is nullptr");
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
auto deathRecipient = new (std::nothrow) InputDeathRecipient();
|
||||
@ -411,8 +412,7 @@ int32_t InputMethodSystemAbility::RequestHideInput()
|
||||
return userSession_->OnRequestHideInput();
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbility::SetCoreAndAgent(
|
||||
const sptr<IInputMethodCore> &core, const sptr<IInputMethodAgent> &agent)
|
||||
int32_t InputMethodSystemAbility::SetCoreAndAgent(const sptr<IInputMethodCore> &core, const sptr<IRemoteObject> &agent)
|
||||
{
|
||||
IMSA_HILOGD("InputMethodSystemAbility run in");
|
||||
if (IsCurrentIme()) {
|
||||
@ -1240,7 +1240,7 @@ bool InputMethodSystemAbility::IsStartInputTypePermitted()
|
||||
return identityChecker_->IsFocused(IPCSkeleton::GetCallingPid(), tokenId) && userSession_->IsBoundToClient();
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbility::ConnectSystemCmd(const sptr<ISystemCmdChannel> &channel, sptr<IRemoteObject> &agent)
|
||||
int32_t InputMethodSystemAbility::ConnectSystemCmd(const sptr<IRemoteObject> &channel, sptr<IRemoteObject> &agent)
|
||||
{
|
||||
auto tokenId = IPCSkeleton::GetCallingTokenID();
|
||||
if (!identityChecker_->HasPermission(tokenId, PERMISSION_CONNECT_IME_ABILITY)) {
|
||||
|
@ -43,10 +43,12 @@ int32_t InputMethodSystemAbilityStub::OnRemoteRequest(
|
||||
int32_t InputMethodSystemAbilityStub::StartInputOnRemote(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
InputClientInfo clientInfo;
|
||||
if (!ITypesUtil::Unmarshal(data, clientInfo)) {
|
||||
sptr<IRemoteObject> client = nullptr;
|
||||
if (!ITypesUtil::Unmarshal(data, clientInfo, client, clientInfo.channel)) {
|
||||
IMSA_HILOGE("read clientInfo failed");
|
||||
return ErrorCode::ERROR_EX_PARCELABLE;
|
||||
}
|
||||
clientInfo.client = iface_cast<IInputClient>(client);
|
||||
sptr<IRemoteObject> agent = nullptr;
|
||||
int32_t ret = StartInput(clientInfo, agent);
|
||||
return reply.WriteInt32(ret) && reply.WriteRemoteObject(agent) ? ErrorCode::NO_ERROR
|
||||
@ -132,7 +134,7 @@ int32_t InputMethodSystemAbilityStub::SetCoreAndAgentOnRemote(MessageParcel &dat
|
||||
IMSA_HILOGE("agentObject is nullptr");
|
||||
return ErrorCode::ERROR_EX_PARCELABLE;
|
||||
}
|
||||
int32_t ret = SetCoreAndAgent(iface_cast<IInputMethodCore>(coreObject), iface_cast<IInputMethodAgent>(agentObject));
|
||||
int32_t ret = SetCoreAndAgent(iface_cast<IInputMethodCore>(coreObject), agentObject);
|
||||
return reply.WriteInt32(ret) ? ErrorCode::NO_ERROR : ErrorCode::ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
@ -262,11 +264,13 @@ int32_t InputMethodSystemAbilityStub::PanelStatusChangeOnRemote(MessageParcel &d
|
||||
int32_t InputMethodSystemAbilityStub::UpdateListenEventFlagOnRemote(MessageParcel &data, MessageParcel &reply)
|
||||
{
|
||||
InputClientInfo clientInfo;
|
||||
sptr<IRemoteObject> client = nullptr;
|
||||
uint32_t eventFlag = 0;
|
||||
if (!ITypesUtil::Unmarshal(data, clientInfo, eventFlag)) {
|
||||
if (!ITypesUtil::Unmarshal(data, clientInfo, client, clientInfo.channel, eventFlag)) {
|
||||
IMSA_HILOGE("Unmarshal failed");
|
||||
return ErrorCode::ERROR_EX_PARCELABLE;
|
||||
}
|
||||
clientInfo.client = iface_cast<IInputClient>(client);
|
||||
int32_t ret = UpdateListenEventFlag(clientInfo, eventFlag);
|
||||
return reply.WriteInt32(ret) ? ErrorCode::NO_ERROR : ErrorCode::ERROR_EX_PARCELABLE;
|
||||
}
|
||||
@ -352,7 +356,7 @@ int32_t InputMethodSystemAbilityStub::ConnectSystemCmdOnRemote(MessageParcel &da
|
||||
return ErrorCode::ERROR_EX_PARCELABLE;
|
||||
}
|
||||
sptr<IRemoteObject> agent = nullptr;
|
||||
int32_t ret = ConnectSystemCmd(iface_cast<ISystemCmdChannel>(systemCmdStub), agent);
|
||||
int32_t ret = ConnectSystemCmd(systemCmdStub, agent);
|
||||
return reply.WriteInt32(ret) && reply.WriteRemoteObject(agent) ? ErrorCode::NO_ERROR
|
||||
: ErrorCode::ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ int32_t PerUserSession::OnStartInput(const InputClientInfo &inputClientInfo, spt
|
||||
IMSA_HILOGE("data or agent is nullptr.");
|
||||
return ErrorCode::ERROR_IME_NOT_STARTED;
|
||||
}
|
||||
agent = data->agent->AsObject();
|
||||
agent = data->agent;
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
|
||||
@ -545,7 +545,7 @@ void PerUserSession::StopClientInput(const sptr<IInputClient> ¤tClient)
|
||||
IMSA_HILOGI("stop client input, ret: %{public}d", ret);
|
||||
}
|
||||
|
||||
void PerUserSession::StopImeInput(ImeType currentType, const sptr<IInputDataChannel> ¤tChannel)
|
||||
void PerUserSession::StopImeInput(ImeType currentType, const sptr<IRemoteObject> ¤tChannel)
|
||||
{
|
||||
auto data = GetImeData(currentType);
|
||||
if (data == nullptr) {
|
||||
@ -568,7 +568,7 @@ void PerUserSession::OnSecurityChange(int32_t security)
|
||||
IMSA_HILOGD("on security change, ret: %{public}d", ret);
|
||||
}
|
||||
|
||||
int32_t PerUserSession::OnSetCoreAndAgent(const sptr<IInputMethodCore> &core, const sptr<IInputMethodAgent> &agent)
|
||||
int32_t PerUserSession::OnSetCoreAndAgent(const sptr<IInputMethodCore> &core, const sptr<IRemoteObject> &agent)
|
||||
{
|
||||
IMSA_HILOGI("run in");
|
||||
auto imeType = ImeType::IME;
|
||||
@ -589,7 +589,7 @@ int32_t PerUserSession::OnSetCoreAndAgent(const sptr<IInputMethodCore> &core, co
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t PerUserSession::OnRegisterProxyIme(const sptr<IInputMethodCore> &core, const sptr<IInputMethodAgent> &agent)
|
||||
int32_t PerUserSession::OnRegisterProxyIme(const sptr<IInputMethodCore> &core, const sptr<IRemoteObject> &agent)
|
||||
{
|
||||
IMSA_HILOGD("run in");
|
||||
auto imeType = ImeType::PROXY_IME;
|
||||
@ -752,7 +752,7 @@ void PerUserSession::NotifyImeChangeToClients(const Property &property, const Su
|
||||
}
|
||||
}
|
||||
|
||||
int32_t PerUserSession::AddImeData(ImeType type, sptr<IInputMethodCore> core, sptr<IInputMethodAgent> agent, pid_t pid)
|
||||
int32_t PerUserSession::AddImeData(ImeType type, sptr<IInputMethodCore> core, sptr<IRemoteObject> agent, pid_t pid)
|
||||
{
|
||||
if (core == nullptr || agent == nullptr) {
|
||||
IMSA_HILOGE("core or agent is nullptr");
|
||||
@ -1160,7 +1160,7 @@ int32_t PerUserSession::RequestIme(const std::shared_ptr<ImeData> &data, Request
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t PerUserSession::OnConnectSystemCmd(const sptr<ISystemCmdChannel> &channel, sptr<IRemoteObject> &agent)
|
||||
int32_t PerUserSession::OnConnectSystemCmd(const sptr<IRemoteObject> &channel, sptr<IRemoteObject> &agent)
|
||||
{
|
||||
auto data = GetImeData(ImeType::IME);
|
||||
if (data == nullptr) {
|
||||
|
@ -25,6 +25,7 @@ ohos_fuzztest("AgentStubFuzzTest") {
|
||||
fuzz_config_file = "//base/inputmethod/imf/test/fuzztest/agentstub_fuzzer"
|
||||
|
||||
include_dirs = [
|
||||
"${inputmethod_path}/common/include",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_ability/include",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_controller/include",
|
||||
]
|
||||
@ -41,7 +42,7 @@ ohos_fuzztest("AgentStubFuzzTest") {
|
||||
"agentstub_fuzzer.cpp",
|
||||
]
|
||||
|
||||
deps = [ "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability" ]
|
||||
deps = [ "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static" ]
|
||||
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include "global.h"
|
||||
#include "input_method_agent_stub.h"
|
||||
#include "message_parcel.h"
|
||||
|
||||
|
@ -36,7 +36,7 @@ ohos_fuzztest("ControlChannelStubFuzzTest") {
|
||||
|
||||
sources = [ "controlchannelstub_fuzzer.cpp" ]
|
||||
|
||||
deps = [ "${inputmethod_path}/services:inputmethod_service" ]
|
||||
deps = [ "${inputmethod_path}/services:inputmethod_service_static" ]
|
||||
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
|
@ -25,6 +25,7 @@ ohos_fuzztest("CoreStubFuzzTest") {
|
||||
fuzz_config_file = "//base/inputmethod/imf/test/fuzztest/corestub_fuzzer"
|
||||
|
||||
include_dirs = [
|
||||
"${inputmethod_path}/common/include",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_controller/include",
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_ability/include",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller/include",
|
||||
@ -37,12 +38,9 @@ ohos_fuzztest("CoreStubFuzzTest") {
|
||||
"-fno-omit-frame-pointer",
|
||||
]
|
||||
|
||||
sources = [
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_controller/src/keyevent_consumer_proxy.cpp",
|
||||
"corestub_fuzzer.cpp",
|
||||
]
|
||||
sources = [ "corestub_fuzzer.cpp" ]
|
||||
|
||||
deps = [ "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability" ]
|
||||
deps = [ "${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static" ]
|
||||
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
#include "global.h"
|
||||
#include "input_method_core_stub.h"
|
||||
#include "message_parcel.h"
|
||||
|
||||
|
@ -37,7 +37,7 @@ ohos_fuzztest("InputClientStubFuzzTest") {
|
||||
sources = [ "inputclientstub_fuzzer.cpp" ]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
]
|
||||
|
@ -62,8 +62,7 @@ void TextOnInputReady()
|
||||
MessageParcel data;
|
||||
data.WriteRemoteObject(mInputMethodAgentStub->AsObject());
|
||||
auto remoteObject = data.ReadRemoteObject();
|
||||
sptr<IInputMethodAgent> iface = iface_cast<IInputMethodAgent>(remoteObject);
|
||||
mClient->OnInputReady(iface);
|
||||
mClient->OnInputReady(remoteObject);
|
||||
}
|
||||
|
||||
void TestOnSwitchInput()
|
||||
|
@ -44,11 +44,9 @@ ohos_fuzztest("PerUserSessionFuzzTest") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/services/json:imf_json_static",
|
||||
"//third_party/cJSON:cjson",
|
||||
"${inputmethod_path}/services:inputmethod_service_static",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
|
@ -30,10 +30,12 @@
|
||||
#include "i_input_method_agent.h"
|
||||
#include "i_input_method_core.h"
|
||||
#include "input_client_proxy.h"
|
||||
#include "input_client_stub.h"
|
||||
#include "input_method_ability.h"
|
||||
#include "input_method_agent_proxy.h"
|
||||
#include "input_method_agent_stub.h"
|
||||
#include "input_method_core_proxy.h"
|
||||
#include "input_method_core_stub.h"
|
||||
#include "input_method_info.h"
|
||||
#include "input_method_property.h"
|
||||
#include "iremote_broker.h"
|
||||
@ -56,16 +58,15 @@ uint32_t ConvertToUint32(const uint8_t *ptr)
|
||||
|
||||
bool InitializeClientInfo(InputClientInfo &clientInfo)
|
||||
{
|
||||
auto clientStub = new (std::nothrow) InputClientStub();
|
||||
sptr<IInputClient> clientStub = new (std::nothrow) InputClientStub();
|
||||
if (clientStub == nullptr) {
|
||||
IMSA_HILOGE("failed to create client");
|
||||
return false;
|
||||
}
|
||||
auto deathRecipient = new (std::nothrow) InputDeathRecipient();
|
||||
sptr<InputDeathRecipient> deathRecipient = new (std::nothrow) InputDeathRecipient();
|
||||
if (deathRecipient == nullptr) {
|
||||
IMSA_HILOGE("failed to new deathRecipient");
|
||||
delete clientStub;
|
||||
return ErrorCode::ERROR_EX_NULL_POINTER;
|
||||
return false;
|
||||
}
|
||||
clientInfo = { .userID = MAIN_USER_ID, .client = clientStub, .deathRecipient = deathRecipient };
|
||||
return true;
|
||||
@ -92,13 +93,13 @@ bool FuzzPerUserSession(const uint8_t *rawData, size_t size)
|
||||
auto agent = iface_cast<IInputMethodAgent>(agentStub);
|
||||
static std::shared_ptr<PerUserSession> userSessions = std::make_shared<PerUserSession>(MAIN_USER_ID);
|
||||
|
||||
userSessions->OnRegisterProxyIme(core, agent);
|
||||
userSessions->OnRegisterProxyIme(core, agent->AsObject());
|
||||
int32_t type = 4;
|
||||
userSessions->OnUnRegisteredProxyIme(static_cast<UnRegisteredType>(type), core);
|
||||
userSessions->IsProxyImeEnable();
|
||||
|
||||
userSessions->OnPrepareInput(clientInfo);
|
||||
userSessions->OnSetCoreAndAgent(core, agent);
|
||||
userSessions->OnSetCoreAndAgent(core, agent->AsObject());
|
||||
userSessions->OnShowCurrentInput();
|
||||
sptr<IRemoteObject> agentObject = nullptr;
|
||||
clientInfo.isShowKeyboard = false;
|
||||
|
@ -41,10 +41,8 @@ ohos_fuzztest("SystemAbilityStubFuzzTest") {
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/services/adapter/settings_data_provider:settings_data_static",
|
||||
"${inputmethod_path}/services:inputmethod_service_static",
|
||||
"${inputmethod_path}/test/common:inputmethod_test_common",
|
||||
"//third_party/cJSON:cjson",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
|
@ -41,10 +41,8 @@ ohos_static_library("imf_sa_stub_fuzztest_common_static") {
|
||||
|
||||
public_deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/services/adapter/settings_data_provider:settings_data_static",
|
||||
"${inputmethod_path}/services:inputmethod_service_static",
|
||||
"${inputmethod_path}/test/common:inputmethod_test_common",
|
||||
"//third_party/cJSON:cjson",
|
||||
]
|
||||
|
||||
public_configs = [ ":imf_sa_stub_fuzztest_common_config" ]
|
||||
|
@ -32,7 +32,6 @@ group("unittest") {
|
||||
"cpp_test:InputMethodPrivateMemberTest",
|
||||
"cpp_test:InputMethodServiceTest",
|
||||
"cpp_test:InputMethodSwitchTest",
|
||||
"cpp_test:InputMethodUtilsTest",
|
||||
"cpp_test:JsonOperateTest",
|
||||
"cpp_test:NewImeSwitchTest",
|
||||
"cpp_test:SecurityModeParseTest",
|
||||
|
@ -44,7 +44,7 @@ ohos_unittest("InputMethodControllerTest") {
|
||||
configs = [ ":module_private_config" ]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/test/common:inputmethod_test_common",
|
||||
@ -84,7 +84,7 @@ ohos_unittest("InputMethodAttachTest") {
|
||||
configs = [ ":module_private_config" ]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/test/common:inputmethod_test_common",
|
||||
@ -114,6 +114,7 @@ ohos_unittest("InputMethodAbilityTest") {
|
||||
module_out_path = module_output_path
|
||||
|
||||
sources = [
|
||||
"${inputmethod_path}/frameworks/native/inputmethod_ability/src/input_method_core_proxy.cpp",
|
||||
"src/input_method_ability_exception_test.cpp",
|
||||
"src/input_method_ability_test.cpp",
|
||||
]
|
||||
@ -126,7 +127,7 @@ ohos_unittest("InputMethodAbilityTest") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/test/common:inputmethod_test_common",
|
||||
@ -170,7 +171,7 @@ ohos_unittest("InputMethodServiceTest") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/test/common:inputmethod_test_common",
|
||||
@ -207,7 +208,7 @@ ohos_unittest("InputMethodDfxTest") {
|
||||
configs = [ ":module_private_config" ]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/common:inputmethod_common",
|
||||
@ -253,7 +254,7 @@ ohos_unittest("InputMethodPanelTest") {
|
||||
]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/test/common:inputmethod_test_common",
|
||||
@ -280,32 +281,6 @@ ohos_unittest("InputMethodPanelTest") {
|
||||
]
|
||||
}
|
||||
|
||||
ohos_unittest("InputMethodUtilsTest") {
|
||||
branch_protector_ret = "pac_ret"
|
||||
sanitize = {
|
||||
cfi = true
|
||||
cfi_cross_dso = true
|
||||
debug = false
|
||||
}
|
||||
module_out_path = module_output_path
|
||||
|
||||
sources = [
|
||||
"src/block_queue_test.cpp",
|
||||
"src/input_method_utils_test.cpp",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"//third_party/googletest:gtest_main",
|
||||
]
|
||||
|
||||
external_deps = [
|
||||
"c_utils:utils",
|
||||
"hilog:libhilog",
|
||||
"ipc:ipc_core",
|
||||
]
|
||||
}
|
||||
|
||||
ohos_unittest("InputMethodSwitchTest") {
|
||||
branch_protector_ret = "pac_ret"
|
||||
sanitize = {
|
||||
@ -355,12 +330,10 @@ ohos_unittest("InputMethodPrivateMemberTest") {
|
||||
configs = [ ":module_private_config" ]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/services/adapter/settings_data_provider:settings_data_static",
|
||||
"${inputmethod_path}/services:inputmethod_service_static",
|
||||
"${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
|
||||
"//third_party/cJSON:cjson",
|
||||
"//third_party/googletest:gtest_main",
|
||||
]
|
||||
|
||||
@ -395,7 +368,7 @@ ohos_unittest("InputMethodEditorTest") {
|
||||
configs = [ ":module_private_config" ]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/test/common:inputmethod_test_common",
|
||||
@ -468,19 +441,10 @@ ohos_unittest("IdentityCheckerTest") {
|
||||
|
||||
configs = [ ":module_private_config" ]
|
||||
|
||||
include_dirs = [
|
||||
"${windowmanager_path}/interfaces/innerkits/dm",
|
||||
"${windowmanager_path}/interfaces/innerkits/wm",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/services/adapter/settings_data_provider:settings_data_static",
|
||||
"${inputmethod_path}/services:inputmethod_service_static",
|
||||
"${inputmethod_path}/test/common:inputmethod_test_common",
|
||||
"${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
|
||||
"//third_party/cJSON:cjson",
|
||||
"//third_party/googletest:gtest_main",
|
||||
]
|
||||
|
||||
@ -516,7 +480,7 @@ ohos_unittest("TextListenerInnerApiTest") {
|
||||
configs = [ ":module_private_config" ]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability_static",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/test/common:inputmethod_test_common",
|
||||
@ -644,7 +608,6 @@ ohos_unittest("SecurityModeParseTest") {
|
||||
|
||||
include_dirs = [
|
||||
"${inputmethod_path}/test/unittest/cpp_test/mock",
|
||||
"${inputmethod_path}/common",
|
||||
"${inputmethod_path}/services/include",
|
||||
"${inputmethod_path}/services/identity_checker/include",
|
||||
"${inputmethod_path}/services/adapter/settings_data_provider/include",
|
||||
@ -654,17 +617,13 @@ ohos_unittest("SecurityModeParseTest") {
|
||||
]
|
||||
|
||||
sources = [
|
||||
"${inputmethod_path}/services/adapter/settings_data_provider/common/src/settings_data_observer.cpp",
|
||||
"${inputmethod_path}/services/adapter/settings_data_provider/common/src/settings_data_utils.cpp",
|
||||
"${inputmethod_path}/services/adapter/settings_data_provider/src/security_mode_parser.cpp",
|
||||
"mock/datashare_helper.cpp",
|
||||
"src/security_mode_parser_test.cpp",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/services/json:imf_json_static",
|
||||
"//third_party/cJSON:cjson",
|
||||
"${inputmethod_path}/services:inputmethod_service_static",
|
||||
"${inputmethod_path}/services/adapter/settings_data_provider:settings_data_static",
|
||||
"//third_party/googletest:gmock",
|
||||
"//third_party/googletest:gtest_main",
|
||||
]
|
||||
@ -697,12 +656,8 @@ ohos_unittest("ImeFreezeManagerTest") {
|
||||
configs = [ ":module_private_config" ]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_ability:inputmethod_ability",
|
||||
"${inputmethod_path}/interfaces/inner_api/inputmethod_controller:inputmethod_client_static",
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/services/adapter/settings_data_provider:settings_data_static",
|
||||
"${inputmethod_path}/services:inputmethod_service_static",
|
||||
"${inputmethod_path}/test/unittest/cpp_test/common:inputmethod_tdd_util",
|
||||
"//third_party/cJSON:cjson",
|
||||
"//third_party/googletest:gtest_main",
|
||||
]
|
||||
|
||||
@ -735,9 +690,8 @@ ohos_unittest("JsonOperateTest") {
|
||||
sources = [ "src/json_operate_test.cpp" ]
|
||||
|
||||
deps = [
|
||||
"${inputmethod_path}/services:inputmethod_service",
|
||||
"${inputmethod_path}/services:inputmethod_service_static",
|
||||
"${inputmethod_path}/services/adapter/settings_data_provider:settings_data_static",
|
||||
"${inputmethod_path}/services/file:imf_file_static",
|
||||
"${inputmethod_path}/services/json:imf_json_static",
|
||||
"//third_party/cJSON:cjson",
|
||||
"//third_party/googletest:gtest_main",
|
||||
|
@ -145,7 +145,7 @@ public:
|
||||
auto agent = inputMethodAbility_->agentStub_->AsObject();
|
||||
imc_->SetAgent(agent);
|
||||
|
||||
sptr<IInputDataChannel> channel = iface_cast<IInputDataChannel>(imc_->clientInfo_.channel->AsObject());
|
||||
sptr<IInputDataChannel> channel = iface_cast<IInputDataChannel>(imc_->clientInfo_.channel);
|
||||
inputMethodAbility_->SetInputDataChannel(channel->AsObject());
|
||||
IMSA_HILOGI("end");
|
||||
}
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "common_event_support.h"
|
||||
#include "display_manager.h"
|
||||
#include "global.h"
|
||||
#include "ime_event_monitor_manager.h"
|
||||
#include "input_method_ability.h"
|
||||
#include "input_method_controller.h"
|
||||
#include "input_method_engine_listener_impl.h"
|
||||
|
@ -43,6 +43,7 @@
|
||||
using namespace testing::ext;
|
||||
namespace OHOS {
|
||||
namespace MiscServices {
|
||||
using namespace AppExecFwk;
|
||||
class InputMethodPrivateMemberTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase(void);
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "global.h"
|
||||
#include "ime_event_monitor_manager_impl.h"
|
||||
#include "ime_info_inquirer.h"
|
||||
#include "ime_setting_listener_test_impl.h"
|
||||
#include "input_method_controller.h"
|
||||
#include "input_method_property.h"
|
||||
@ -71,15 +70,11 @@ constexpr const char *ENABLE_IME_KEYWORD = "settings.inputmethod.enable_ime";
|
||||
void InputMethodSwitchTest::SetUpTestCase(void)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodSwitchTest::SetUpTestCase");
|
||||
ImeInfoInquirer::GetInstance().InitSystemConfig();
|
||||
enableOn = ImeInfoInquirer::GetInstance().IsEnableInputMethod();
|
||||
TddUtil::GrantNativePermission();
|
||||
if (enableOn == true) {
|
||||
int32_t ret = TddUtil::GetEnableData(beforeValue);
|
||||
if (ret == ErrorCode::NO_ERROR) {
|
||||
IMSA_HILOGI("Enable ime switch test.");
|
||||
int32_t ret = TddUtil::GetEnableData(beforeValue);
|
||||
if (ret == ErrorCode::NO_ERROR) {
|
||||
TddUtil::PushEnableImeValue(ENABLE_IME_KEYWORD, allEnableIme);
|
||||
}
|
||||
TddUtil::PushEnableImeValue(ENABLE_IME_KEYWORD, allEnableIme);
|
||||
}
|
||||
TddUtil::StorageSelfTokenID();
|
||||
TddUtil::SetTestTokenID(
|
||||
|
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2023 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.
|
||||
*/
|
||||
#include "input_method_utils.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <gtest/gtest.h>
|
||||
#include <string>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "global.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
namespace OHOS {
|
||||
namespace MiscServices {
|
||||
class InputMethodUtilsTest : public testing::Test {
|
||||
public:
|
||||
static void SetUpTestCase(void);
|
||||
static void TearDownTestCase(void);
|
||||
void SetUp();
|
||||
void TearDown();
|
||||
};
|
||||
|
||||
void InputMethodUtilsTest::SetUpTestCase(void)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodUtilsTest::SetUpTestCase");
|
||||
}
|
||||
|
||||
void InputMethodUtilsTest::TearDownTestCase(void)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodUtilsTest::TearDownTestCase");
|
||||
}
|
||||
|
||||
void InputMethodUtilsTest::SetUp(void)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodUtilsTest::SetUp");
|
||||
}
|
||||
|
||||
void InputMethodUtilsTest::TearDown(void)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodUtilsTest::TearDown");
|
||||
}
|
||||
|
||||
/**
|
||||
* @tc.name: inputMethodUtils_functionKey_001
|
||||
* @tc.desc: Checkout FunctionKey.
|
||||
* @tc.type: FUNC
|
||||
*/
|
||||
HWTEST_F(InputMethodUtilsTest, inputMethodUtils_functionKey_001, TestSize.Level0)
|
||||
{
|
||||
FunctionKey info;
|
||||
info.SetEnterKeyType(EnterKeyType::UNSPECIFIED);
|
||||
EnterKeyType keyType = info.GetEnterKeyType();
|
||||
EXPECT_EQ(keyType, EnterKeyType::UNSPECIFIED);
|
||||
}
|
||||
} // namespace MiscServices
|
||||
} // namespace OHOS
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include "global.h"
|
||||
#include "ime_event_monitor_manager_impl.h"
|
||||
#include "ime_info_inquirer.h"
|
||||
#include "ime_setting_listener_test_impl.h"
|
||||
#include "input_method_controller.h"
|
||||
#include "input_method_property.h"
|
||||
@ -64,15 +63,11 @@ constexpr const char *ENABLE_IME_KEYWORD = "settings.inputmethod.enable_ime";
|
||||
void NewImeSwitchTest::SetUpTestCase(void)
|
||||
{
|
||||
IMSA_HILOGI("NewImeSwitchTest::SetUpTestCase");
|
||||
ImeInfoInquirer::GetInstance().InitSystemConfig();
|
||||
enableOn = ImeInfoInquirer::GetInstance().IsEnableInputMethod();
|
||||
TddUtil::GrantNativePermission();
|
||||
if (enableOn == true) {
|
||||
int32_t ret = TddUtil::GetEnableData(beforeValue);
|
||||
if (ret == ErrorCode::NO_ERROR) {
|
||||
IMSA_HILOGI("Enable ime switch test.");
|
||||
int32_t ret = TddUtil::GetEnableData(beforeValue);
|
||||
if (ret == ErrorCode::NO_ERROR) {
|
||||
TddUtil::PushEnableImeValue(ENABLE_IME_KEYWORD, allEnableIme);
|
||||
}
|
||||
TddUtil::PushEnableImeValue(ENABLE_IME_KEYWORD, allEnableIme);
|
||||
}
|
||||
TddUtil::StorageSelfTokenID();
|
||||
TddUtil::SetTestTokenID(
|
||||
|
@ -17,8 +17,6 @@
|
||||
#define protected public
|
||||
#include "security_mode_parser.h"
|
||||
|
||||
#include "ime_cfg_manager.h"
|
||||
#include "ime_info_inquirer.h"
|
||||
#include "input_method_system_ability.h"
|
||||
#undef private
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user