mirror of
https://github.com/openharmony/miscservices_inputmethod.git
synced 2026-07-20 23:45:31 -04:00
@@ -41,14 +41,11 @@ namespace MiscServices {
|
||||
EventTarget::~EventTarget()
|
||||
{
|
||||
EventListener *temp = nullptr;
|
||||
for (EventListener *i = first_; i != nullptr; i = temp)
|
||||
{
|
||||
for (EventListener *i = first_; i != nullptr; i = temp) {
|
||||
temp = i->next;
|
||||
if (i == first_)
|
||||
{
|
||||
if (i == first_) {
|
||||
first_ = first_->next;
|
||||
} else if (i == last_)
|
||||
{
|
||||
} else if (i == last_) {
|
||||
last_ = last_->back;
|
||||
} else {
|
||||
i->next->back = i->back;
|
||||
@@ -66,15 +63,13 @@ namespace MiscServices {
|
||||
IMSA_HILOGI("EventTarget::On");
|
||||
auto tmp = new EventListener();
|
||||
|
||||
if (strncpy_s(tmp->type, LISTENER_TYPTE_MAX_LENGTH, type, strlen(type)) == -1)
|
||||
{
|
||||
if (strncpy_s(tmp->type, LISTENER_TYPTE_MAX_LENGTH, type, strlen(type)) == -1) {
|
||||
delete tmp;
|
||||
tmp = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
if (first_ == nullptr)
|
||||
{
|
||||
if (first_ == nullptr) {
|
||||
first_ = last_ = tmp;
|
||||
} else {
|
||||
last_->next = tmp;
|
||||
@@ -90,15 +85,13 @@ namespace MiscServices {
|
||||
IMSA_HILOGI("EventTarget::Once");
|
||||
auto tmp = new EventListener();
|
||||
|
||||
if (strncpy_s(tmp->type, LISTENER_TYPTE_MAX_LENGTH, type, strlen(type)) == -1)
|
||||
{
|
||||
if (strncpy_s(tmp->type, LISTENER_TYPTE_MAX_LENGTH, type, strlen(type)) == -1) {
|
||||
delete tmp;
|
||||
tmp = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
if (first_ == nullptr)
|
||||
{
|
||||
if (first_ == nullptr) {
|
||||
first_ = last_ = tmp;
|
||||
} else {
|
||||
last_->next = tmp;
|
||||
@@ -114,24 +107,20 @@ namespace MiscServices {
|
||||
IMSA_HILOGI("EventTarget::Off");
|
||||
napi_handle_scope scope = nullptr;
|
||||
napi_open_handle_scope(env_, &scope);
|
||||
if (scope == nullptr)
|
||||
{
|
||||
if (scope == nullptr) {
|
||||
HILOG_ERROR("scope is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
EventListener *temp = nullptr;
|
||||
for (EventListener *eventListener = first_; eventListener != nullptr; eventListener = temp)
|
||||
{
|
||||
for (EventListener *eventListener = first_; eventListener != nullptr; eventListener = temp) {
|
||||
temp = eventListener->next;
|
||||
bool isEquals = false;
|
||||
napi_value handlerTemp = nullptr;
|
||||
napi_get_reference_value(env_, eventListener->handlerRef, &handlerTemp);
|
||||
napi_strict_equals(env_, handlerTemp, handler, &isEquals);
|
||||
if (strcmp(eventListener->type, type) == 0 && isEquals)
|
||||
{
|
||||
if (eventListener == first_)
|
||||
{
|
||||
if (strcmp(eventListener->type, type) == 0 && isEquals) {
|
||||
if (eventListener == first_) {
|
||||
first_ = first_->next;
|
||||
} else if (eventListener == last_) {
|
||||
last_ = last_->back;
|
||||
@@ -152,13 +141,10 @@ namespace MiscServices {
|
||||
{
|
||||
IMSA_HILOGI("EventTarget::Off");
|
||||
EventListener *temp = nullptr;
|
||||
for (EventListener *eventListener = first_; eventListener != nullptr; eventListener = temp)
|
||||
{
|
||||
for (EventListener *eventListener = first_; eventListener != nullptr; eventListener = temp) {
|
||||
temp = eventListener->next;
|
||||
if (strcmp(eventListener->type, type) == 0)
|
||||
{
|
||||
if (eventListener == first_)
|
||||
{
|
||||
if (strcmp(eventListener->type, type) == 0) {
|
||||
if (eventListener == first_) {
|
||||
first_ = first_->next;
|
||||
} else if (eventListener == last_) {
|
||||
last_ = last_->back;
|
||||
@@ -181,17 +167,14 @@ namespace MiscServices {
|
||||
|
||||
napi_value thisVar = nullptr;
|
||||
napi_get_reference_value(env_, thisVarRef_, &thisVar);
|
||||
for (EventListener *eventListener = first_; eventListener != nullptr; eventListener = eventListener->next)
|
||||
{
|
||||
if (strcmp(eventListener->type, type) == 0)
|
||||
{
|
||||
for (EventListener *eventListener = first_; eventListener != nullptr; eventListener = eventListener->next) {
|
||||
if (strcmp(eventListener->type, type) == 0) {
|
||||
napi_value jsEvent = event ? event->ToJsObject() : nullptr;
|
||||
napi_value handler = nullptr;
|
||||
napi_value result = nullptr;
|
||||
napi_get_reference_value(env_, eventListener->handlerRef, &handler);
|
||||
napi_call_function(env_, thisVar, handler, jsEvent ? 1 : 0, jsEvent ? &jsEvent : nullptr, &result);
|
||||
if (eventListener->isOnce)
|
||||
{
|
||||
if (eventListener->isOnce) {
|
||||
Off(type, handler);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,7 @@ namespace MiscServices {
|
||||
|
||||
InputMethodAbility::~InputMethodAbility()
|
||||
{
|
||||
if (msgHandler != nullptr)
|
||||
{
|
||||
if (msgHandler != nullptr) {
|
||||
delete msgHandler;
|
||||
msgHandler = nullptr;
|
||||
}
|
||||
@@ -47,11 +46,9 @@ namespace MiscServices {
|
||||
sptr<InputMethodAbility> InputMethodAbility::GetInstance()
|
||||
{
|
||||
IMSA_HILOGI("InputMethodAbility::GetInstance");
|
||||
if (instance_ == nullptr)
|
||||
{
|
||||
if (instance_ == nullptr) {
|
||||
std::lock_guard<std::mutex> autoLock(instanceLock_);
|
||||
if (instance_ == nullptr)
|
||||
{
|
||||
if (instance_ == nullptr) {
|
||||
IMSA_HILOGI("InputMethodAbility::GetInstance need new IMA");
|
||||
instance_ = new InputMethodAbility();
|
||||
}
|
||||
@@ -64,15 +61,13 @@ namespace MiscServices {
|
||||
IMSA_HILOGI("InputMethodAbility::GetImsaProxy");
|
||||
sptr<ISystemAbilityManager> systemAbilityManager =
|
||||
SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (systemAbilityManager == nullptr)
|
||||
{
|
||||
if (systemAbilityManager == nullptr) {
|
||||
IMSA_HILOGI("InputMethodAbility::GetImsaProxy systemAbilityManager is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto systemAbility = systemAbilityManager->GetSystemAbility(INPUT_METHOD_SYSTEM_ABILITY_ID, "");
|
||||
if (systemAbility == nullptr)
|
||||
{
|
||||
if (systemAbility == nullptr) {
|
||||
IMSA_HILOGI("InputMethodAbility::GetImsaProxy systemAbility is nullptr");
|
||||
return nullptr;
|
||||
}
|
||||
@@ -88,8 +83,7 @@ namespace MiscServices {
|
||||
sptr<InputMethodCoreStub> stub = new InputMethodCoreStub(0);
|
||||
stub->SetMessageHandler(msgHandler);
|
||||
sptr<IInputMethodCore> stub2 = stub;
|
||||
if (mImms != nullptr)
|
||||
{
|
||||
if (mImms != nullptr) {
|
||||
mImms->setInputMethodCore(stub2);
|
||||
}
|
||||
IMSA_HILOGI("InputMethodAbility::OnConnect() mImms is nullptr");
|
||||
@@ -115,8 +109,7 @@ namespace MiscServices {
|
||||
|
||||
void InputMethodAbility::WorkThread()
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
while(1) {
|
||||
Message *msg = msgHandler->GetMessage();
|
||||
switch (msg->msgId_) {
|
||||
case MSG_ID_INITIALIZE_INPUT: {
|
||||
@@ -164,15 +157,13 @@ namespace MiscServices {
|
||||
MessageParcel *data = msg->msgContent_;
|
||||
displyId = data->ReadInt32();
|
||||
sptr<IRemoteObject> channelObject = data->ReadRemoteObject();
|
||||
if (channelObject == nullptr)
|
||||
{
|
||||
if (channelObject == nullptr) {
|
||||
IMSA_HILOGI("InputMethodAbility::OnInitialInput channelObject is nullptr");
|
||||
return;
|
||||
}
|
||||
sptr<InputControlChannelProxy> channelProxy = new InputControlChannelProxy(channelObject);
|
||||
inputControlChannel = channelProxy;
|
||||
if (inputControlChannel == nullptr)
|
||||
{
|
||||
if (inputControlChannel == nullptr) {
|
||||
IMSA_HILOGI("InputMethodAbility::OnInitialInput inputControlChannel is nullptr");
|
||||
return;
|
||||
}
|
||||
@@ -185,20 +176,17 @@ namespace MiscServices {
|
||||
MessageParcel *data = msg->msgContent_;
|
||||
sptr<InputDataChannelProxy> channalProxy = new InputDataChannelProxy(data->ReadRemoteObject());
|
||||
inputDataChannel = channalProxy;
|
||||
if (inputDataChannel == nullptr)
|
||||
{
|
||||
if (inputDataChannel == nullptr) {
|
||||
IMSA_HILOGI("InputMethodAbility::OnStartInput inputDataChannel is nullptr");
|
||||
}
|
||||
editorAttribute = data->ReadParcelable<InputAttribute>();
|
||||
if (editorAttribute == nullptr)
|
||||
{
|
||||
if (editorAttribute == nullptr) {
|
||||
IMSA_HILOGI("InputMethodAbility::OnStartInput editorAttribute is nullptr");
|
||||
}
|
||||
mSupportPhysicalKbd = data->ReadBool();
|
||||
|
||||
CreateInputMethodAgent(mSupportPhysicalKbd);
|
||||
if (inputControlChannel != nullptr)
|
||||
{
|
||||
if (inputControlChannel != nullptr) {
|
||||
IMSA_HILOGI("InputMethodAbility::OnStartInput inputControlChannel is not nullptr");
|
||||
inputControlChannel->onAgentCreated(inputMethodAgent, nullptr);
|
||||
}
|
||||
@@ -219,8 +207,7 @@ namespace MiscServices {
|
||||
void InputMethodAbility::OnStopInput(Message *msg)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodAbility::OnStopInput");
|
||||
if (writeInputChannel != nullptr)
|
||||
{
|
||||
if (writeInputChannel != nullptr) {
|
||||
delete writeInputChannel;
|
||||
writeInputChannel = nullptr;
|
||||
}
|
||||
@@ -264,8 +251,7 @@ namespace MiscServices {
|
||||
bool InputMethodAbility::InsertText(const std::string text)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodAbility::InsertText");
|
||||
if (inputDataChannel == nullptr)
|
||||
{
|
||||
if (inputDataChannel == nullptr) {
|
||||
IMSA_HILOGI("InputMethodAbility::InsertText inputDataChanel is nullptr");
|
||||
return false;
|
||||
}
|
||||
@@ -276,8 +262,7 @@ namespace MiscServices {
|
||||
void InputMethodAbility::DeleteBackward(int32_t length)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodAbility::DeleteBackward");
|
||||
if (inputDataChannel == nullptr)
|
||||
{
|
||||
if (inputDataChannel == nullptr) {
|
||||
IMSA_HILOGI("InputMethodAbility::DeleteBackward inputDataChanel is nullptr");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -28,8 +28,7 @@ namespace MiscServices {
|
||||
IMSA_HILOGI("InputMethodAgentProxy::DispatchKey key = %{public}d, status = %{public}d", key, status);
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor()))
|
||||
{
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
IMSA_HILOGI("InputMethodAgentProxy::DispatchKey descriptor is not match");
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
@@ -35,8 +35,7 @@ namespace MiscServices {
|
||||
{
|
||||
IMSA_HILOGI("InputMethodAgentStub::OnRemoteRequest code = %{public}d", code);
|
||||
auto descriptorToken = data.ReadInterfaceToken();
|
||||
if (descriptorToken != GetDescriptor())
|
||||
{
|
||||
if (descriptorToken != GetDescriptor()) {
|
||||
return ErrorCode::ERROR_STATUS_UNKNOWN_TRANSACTION;
|
||||
}
|
||||
|
||||
@@ -45,8 +44,7 @@ namespace MiscServices {
|
||||
int32_t key = data.ReadInt32();
|
||||
int32_t status = data.ReadInt32();
|
||||
int32_t result = DispatchKey(key, status);
|
||||
if (result == ErrorCode::NO_ERROR)
|
||||
{
|
||||
if (result == ErrorCode::NO_ERROR) {
|
||||
reply.WriteNoException();
|
||||
} else {
|
||||
reply.WriteInt32(result);
|
||||
@@ -63,8 +61,7 @@ namespace MiscServices {
|
||||
int32_t InputMethodAgentStub::DispatchKey(int32_t key, int32_t status)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodAgentStub::DispatchKey key = %{public}d, status = %{public}d", key, status);
|
||||
if (msgHandler_ == nullptr)
|
||||
{
|
||||
if (msgHandler_ == nullptr) {
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
MessageParcel *data = new MessageParcel();
|
||||
|
||||
@@ -31,13 +31,11 @@ namespace MiscServices {
|
||||
sptr<IInputControlChannel> &inputControlChannel)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreProxy::initializeInput");
|
||||
if (startInputToken == nullptr)
|
||||
{
|
||||
if (startInputToken == nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::initializeInput startInputToken is nullptr");
|
||||
}
|
||||
|
||||
if (inputControlChannel == nullptr)
|
||||
{
|
||||
if (inputControlChannel == nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::initializeInput inputControlChannel is nullptr");
|
||||
}
|
||||
IMSA_HILOGI("InputMethodCoreProxy::initializeInput displayId = %{public}d", displayId);
|
||||
@@ -45,13 +43,11 @@ namespace MiscServices {
|
||||
data.WriteInterfaceToken(GetDescriptor());
|
||||
data.WriteInt32(displayId);
|
||||
sptr<IRemoteObject> channelObject = inputControlChannel->AsObject();
|
||||
if (channelObject == nullptr)
|
||||
{
|
||||
if (channelObject == nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::initializeInput channelObject is nullptr");
|
||||
}
|
||||
bool wor = data.WriteRemoteObject(channelObject);
|
||||
if (wor)
|
||||
{
|
||||
if (wor) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::initializeInput Success to write inputControlChannel");
|
||||
} else {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::initializeInput Failed to write inputControlChannel");
|
||||
@@ -60,8 +56,7 @@ namespace MiscServices {
|
||||
MessageOption::TF_SYNC
|
||||
};
|
||||
int32_t status = Remote()->SendRequest(INITIALIZE_INPUT, data, reply, option);
|
||||
if (status != ErrorCode::NO_ERROR)
|
||||
{
|
||||
if (status != ErrorCode::NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::initializeInput status = %{public}d", status);
|
||||
return status;
|
||||
}
|
||||
@@ -73,8 +68,7 @@ namespace MiscServices {
|
||||
const InputAttribute& editorAttribute, bool supportPhysicalKbd)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreProxy::startInput");
|
||||
if (inputDataChannel == nullptr)
|
||||
{
|
||||
if (inputDataChannel == nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::startInput inputDataChannel is nullptr");
|
||||
}
|
||||
|
||||
@@ -82,8 +76,7 @@ namespace MiscServices {
|
||||
if (!(data.WriteInterfaceToken(GetDescriptor())
|
||||
&& data.WriteRemoteObject(inputDataChannel->AsObject())
|
||||
&& data.WriteParcelable(&editorAttribute)
|
||||
&& data.WriteBool(supportPhysicalKbd)))
|
||||
{
|
||||
&& data.WriteBool(supportPhysicalKbd))) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::startInput write error");
|
||||
return false;
|
||||
}
|
||||
@@ -93,8 +86,7 @@ namespace MiscServices {
|
||||
};
|
||||
|
||||
int32_t status = Remote()->SendRequest(START_INPUT, data, reply, option);
|
||||
if (status != ErrorCode::NO_ERROR)
|
||||
{
|
||||
if (status != ErrorCode::NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::startInput status = %{public}d", status);
|
||||
return false;
|
||||
}
|
||||
@@ -112,14 +104,12 @@ namespace MiscServices {
|
||||
MessageOption::TF_SYNC
|
||||
};
|
||||
int32_t status = Remote()->SendRequest(STOP_INPUT, data, reply, option);
|
||||
if (status != ErrorCode::NO_ERROR)
|
||||
{
|
||||
if (status != ErrorCode::NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::stopInput status = %{public}d", status);
|
||||
return status;
|
||||
}
|
||||
int code = reply.ReadException();
|
||||
if (code != ErrorCode::NO_ERROR)
|
||||
{
|
||||
if (code != ErrorCode::NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::stopInput code = %{public}d", code);
|
||||
return code;
|
||||
}
|
||||
@@ -130,15 +120,13 @@ namespace MiscServices {
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreProxy::showKeyboard");
|
||||
auto remote = Remote();
|
||||
if (remote == nullptr)
|
||||
{
|
||||
if (remote == nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::showKeyboard remote is nullptr");
|
||||
return false;
|
||||
}
|
||||
|
||||
MessageParcel data;
|
||||
if (!(data.WriteInterfaceToken(GetDescriptor()) && data.WriteInt32(flags)))
|
||||
{
|
||||
if (!(data.WriteInterfaceToken(GetDescriptor()) && data.WriteInt32(flags))) {
|
||||
return false;
|
||||
}
|
||||
MessageParcel reply;
|
||||
@@ -147,8 +135,7 @@ namespace MiscServices {
|
||||
};
|
||||
|
||||
int32_t res = remote->SendRequest(SHOW_KEYBOARD, data, reply, option);
|
||||
if (res != ErrorCode::NO_ERROR)
|
||||
{
|
||||
if (res != ErrorCode::NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -158,14 +145,12 @@ namespace MiscServices {
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreProxy::hideKeyboard");
|
||||
auto remote = Remote();
|
||||
if (remote == nullptr)
|
||||
{
|
||||
if (remote == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MessageParcel data;
|
||||
if (!(data.WriteInterfaceToken(GetDescriptor()) && data.WriteInt32(flags)))
|
||||
{
|
||||
if (!(data.WriteInterfaceToken(GetDescriptor()) && data.WriteInt32(flags))) {
|
||||
return false;
|
||||
}
|
||||
MessageParcel reply;
|
||||
@@ -174,8 +159,7 @@ namespace MiscServices {
|
||||
};
|
||||
|
||||
int32_t res = remote->SendRequest(HIDE_KEYBOARD, data, reply, option);
|
||||
if (res != ErrorCode::NO_ERROR)
|
||||
{
|
||||
if (res != ErrorCode::NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -191,8 +175,7 @@ namespace MiscServices {
|
||||
MessageOption::TF_SYNC
|
||||
};
|
||||
int32_t status = Remote()->SendRequest(SET_KEYBOARD_TYPE, data, reply, option);
|
||||
if (status != ErrorCode::NO_ERROR)
|
||||
{
|
||||
if (status != ErrorCode::NO_ERROR) {
|
||||
return status;
|
||||
}
|
||||
int32_t code = reply.ReadException();
|
||||
@@ -208,13 +191,11 @@ namespace MiscServices {
|
||||
MessageOption::TF_SYNC
|
||||
};
|
||||
int32_t status = Remote()->SendRequest(GET_KEYBOARD_WINDOW_HEIGHT, data, reply, option);
|
||||
if (status != ErrorCode::NO_ERROR)
|
||||
{
|
||||
if (status != ErrorCode::NO_ERROR) {
|
||||
return status;
|
||||
}
|
||||
int32_t code = reply.ReadException();
|
||||
if (code != 0)
|
||||
{
|
||||
if (code != 0) {
|
||||
return code;
|
||||
}
|
||||
retHeight = reply.ReadInt32();
|
||||
|
||||
@@ -44,8 +44,7 @@ namespace MiscServices {
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest");
|
||||
auto descriptorToken = data.ReadInterfaceToken();
|
||||
if (descriptorToken != GetDescriptor())
|
||||
{
|
||||
if (descriptorToken != GetDescriptor()) {
|
||||
IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest descriptorToken is invalid");
|
||||
return ErrorCode::ERROR_STATUS_UNKNOWN_TRANSACTION;
|
||||
}
|
||||
@@ -55,13 +54,11 @@ namespace MiscServices {
|
||||
int32_t displayId = data.ReadInt32();
|
||||
IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest displayId = %{public}d", displayId);
|
||||
sptr<IRemoteObject> channelObject = data.ReadRemoteObject();
|
||||
if (channelObject == nullptr)
|
||||
{
|
||||
if (channelObject == nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest channelObject is nullptr");
|
||||
}
|
||||
sptr<IInputControlChannel> inputControlChannel = new InputControlChannelProxy(channelObject);
|
||||
if (inputControlChannel == nullptr)
|
||||
{
|
||||
if (inputControlChannel == nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest inputControlChannel is nullptr");
|
||||
}
|
||||
|
||||
@@ -74,8 +71,7 @@ namespace MiscServices {
|
||||
InputAttribute *editorAttribute = data.ReadParcelable<InputAttribute>();
|
||||
bool supportPhysicalKbd = data.ReadBool();
|
||||
|
||||
if (inputDataChannel == nullptr)
|
||||
{
|
||||
if (inputDataChannel == nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest START_INPUT inputDataChannel is nulltpr");
|
||||
}
|
||||
startInput(inputDataChannel, *editorAttribute, supportPhysicalKbd);
|
||||
@@ -122,20 +118,17 @@ namespace MiscServices {
|
||||
sptr<IInputControlChannel>& inputControlChannel)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreStub::initializeInput");
|
||||
if (msgHandler_ == nullptr)
|
||||
{
|
||||
if (msgHandler_ == nullptr) {
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
if (startInputToken == nullptr)
|
||||
{
|
||||
if (startInputToken == nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreStub::initializeInput startInputToken is nullptr");
|
||||
}
|
||||
|
||||
MessageParcel *data = new MessageParcel();
|
||||
data->WriteInt32(displayId);
|
||||
if (inputControlChannel != nullptr)
|
||||
{
|
||||
if (inputControlChannel != nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreStub::initializeInput. inputControlChannel is not nullptr");
|
||||
data->WriteRemoteObject(inputControlChannel->AsObject());
|
||||
}
|
||||
@@ -148,13 +141,11 @@ namespace MiscServices {
|
||||
const InputAttribute& editorAttribute, bool supportPhysicalKbd)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreStub::startInput");
|
||||
if (msgHandler_ == nullptr)
|
||||
{
|
||||
if (msgHandler_ == nullptr) {
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
MessageParcel *data = new MessageParcel();
|
||||
if (inputDataChannel != nullptr)
|
||||
{
|
||||
if (inputDataChannel != nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreStub::startInput inputDataChannel is not nullptr");
|
||||
data->WriteRemoteObject(inputDataChannel->AsObject());
|
||||
}
|
||||
@@ -168,8 +159,7 @@ namespace MiscServices {
|
||||
int32_t InputMethodCoreStub::stopInput()
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreStub::stopInput");
|
||||
if (msgHandler_ == nullptr)
|
||||
{
|
||||
if (msgHandler_ == nullptr) {
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
MessageParcel *data = new MessageParcel();
|
||||
@@ -181,8 +171,7 @@ namespace MiscServices {
|
||||
bool InputMethodCoreStub::showKeyboard(int32_t flags)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreStub::showKeyboard");
|
||||
if (msgHandler_ == nullptr)
|
||||
{
|
||||
if (msgHandler_ == nullptr) {
|
||||
return false;
|
||||
}
|
||||
MessageParcel *data = new MessageParcel();
|
||||
@@ -197,8 +186,7 @@ namespace MiscServices {
|
||||
bool InputMethodCoreStub::hideKeyboard(int32_t flags)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreStub::hideKeyboard");
|
||||
if (msgHandler_ == nullptr)
|
||||
{
|
||||
if (msgHandler_ == nullptr) {
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
MessageParcel *data = new MessageParcel();
|
||||
@@ -213,8 +201,7 @@ namespace MiscServices {
|
||||
int32_t InputMethodCoreStub::setKeyboardType(const KeyboardType& type)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreStub::setKeyboardType");
|
||||
if (msgHandler_ == nullptr)
|
||||
{
|
||||
if (msgHandler_ == nullptr) {
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
MessageParcel *data = new MessageParcel();
|
||||
@@ -228,8 +215,7 @@ namespace MiscServices {
|
||||
int32_t InputMethodCoreStub::getKeyboardWindowHeight(int32_t retHeight)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreStub::getKeyboardWindowHeight");
|
||||
if (msgHandler_ == nullptr)
|
||||
{
|
||||
if (msgHandler_ == nullptr) {
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
MessageParcel *data = new MessageParcel();
|
||||
|
||||
Reference in New Issue
Block a user