mirror of
https://github.com/openharmony/miscservices_inputmethod.git
synced 2026-07-18 17:24:37 -04:00
@@ -32,6 +32,11 @@ namespace MiscServices {
|
||||
sptr<IInputControlChannel> &inputControlChannel)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreProxy::initializeInput");
|
||||
auto remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
IMSA_HILOGI("remote is nullptr");
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
if (startInputToken == nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::initializeInput startInputToken is nullptr");
|
||||
}
|
||||
@@ -56,7 +61,7 @@ namespace MiscServices {
|
||||
MessageOption option {
|
||||
MessageOption::TF_SYNC
|
||||
};
|
||||
int32_t status = Remote()->SendRequest(INITIALIZE_INPUT, data, reply, option);
|
||||
int32_t status = remote->SendRequest(INITIALIZE_INPUT, data, reply, option);
|
||||
if (status != ErrorCode::NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::initializeInput status = %{public}d", status);
|
||||
return status;
|
||||
@@ -68,7 +73,11 @@ namespace MiscServices {
|
||||
int32_t InputMethodCoreProxy::InitInputControlChannel(sptr<IInputControlChannel> &inputControlChannel)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreProxy::InitInputControlChannel");
|
||||
|
||||
auto remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
IMSA_HILOGI("remote is nullptr");
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
if (inputControlChannel == nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::InitInputControlChannel inputControlChannel is nullptr");
|
||||
return ErrorCode::ERROR_EX_NULL_POINTER;
|
||||
@@ -84,7 +93,7 @@ namespace MiscServices {
|
||||
MessageOption option {
|
||||
MessageOption::TF_SYNC
|
||||
};
|
||||
int32_t status = Remote()->SendRequest(INIT_INPUT_CONTROL_CHANNEL, data, reply, option);
|
||||
int32_t status = remote->SendRequest(INIT_INPUT_CONTROL_CHANNEL, data, reply, option);
|
||||
if (status != ErrorCode::NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::InitInputControlChannel status = %{public}d", status);
|
||||
return status;
|
||||
@@ -96,6 +105,11 @@ namespace MiscServices {
|
||||
void InputMethodCoreProxy::SetClientState(bool state)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreProxy::SetClientState");
|
||||
auto remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
IMSA_HILOGI("remote is nullptr");
|
||||
return;
|
||||
}
|
||||
MessageParcel data;
|
||||
if (!(data.WriteInterfaceToken(GetDescriptor())
|
||||
&& data.WriteBool(state))) {
|
||||
@@ -107,7 +121,7 @@ namespace MiscServices {
|
||||
MessageOption::TF_SYNC
|
||||
};
|
||||
|
||||
int32_t status = Remote()->SendRequest(SET_CLIENT_STATE, data, reply, option);
|
||||
int32_t status = remote->SendRequest(SET_CLIENT_STATE, data, reply, option);
|
||||
if (status != ErrorCode::NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::SetClientState status = %{public}d", status);
|
||||
}
|
||||
@@ -116,6 +130,11 @@ namespace MiscServices {
|
||||
const InputAttribute& editorAttribute, bool supportPhysicalKbd)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreProxy::startInput");
|
||||
auto remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
IMSA_HILOGI("remote is nullptr");
|
||||
return false;
|
||||
}
|
||||
if (inputDataChannel == nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::startInput inputDataChannel is nullptr");
|
||||
}
|
||||
@@ -133,7 +152,7 @@ namespace MiscServices {
|
||||
MessageOption::TF_SYNC
|
||||
};
|
||||
|
||||
int32_t status = Remote()->SendRequest(START_INPUT, data, reply, option);
|
||||
int32_t status = remote->SendRequest(START_INPUT, data, reply, option);
|
||||
if (status != ErrorCode::NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::startInput status = %{public}d", status);
|
||||
return false;
|
||||
@@ -146,12 +165,17 @@ namespace MiscServices {
|
||||
int32_t InputMethodCoreProxy::stopInput()
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreProxy::stopInput");
|
||||
auto remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
IMSA_HILOGI("remote is nullptr");
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
MessageParcel data, reply;
|
||||
data.WriteInterfaceToken(GetDescriptor());
|
||||
MessageOption option {
|
||||
MessageOption::TF_SYNC
|
||||
};
|
||||
int32_t status = Remote()->SendRequest(STOP_INPUT, data, reply, option);
|
||||
int32_t status = remote->SendRequest(STOP_INPUT, data, reply, option);
|
||||
if (status != ErrorCode::NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::stopInput status = %{public}d", status);
|
||||
return status;
|
||||
@@ -193,7 +217,6 @@ namespace MiscServices {
|
||||
void InputMethodCoreProxy::StopInputService(std::string imeId)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreProxy::StopInputService");
|
||||
|
||||
auto remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
IMSA_HILOGI("InputMethodCoreProxy::StopInputService remote is nullptr");
|
||||
@@ -242,13 +265,18 @@ namespace MiscServices {
|
||||
int32_t InputMethodCoreProxy::setKeyboardType(const KeyboardType& type)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreProxy::setKeyboardType");
|
||||
auto remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
IMSA_HILOGI("remote is nullptr");
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
MessageParcel data, reply;
|
||||
data.WriteInterfaceToken(GetDescriptor());
|
||||
data.WriteParcelable(&type);
|
||||
MessageOption option {
|
||||
MessageOption::TF_SYNC
|
||||
};
|
||||
int32_t status = Remote()->SendRequest(SET_KEYBOARD_TYPE, data, reply, option);
|
||||
int32_t status = remote->SendRequest(SET_KEYBOARD_TYPE, data, reply, option);
|
||||
if (status != ErrorCode::NO_ERROR) {
|
||||
return status;
|
||||
}
|
||||
@@ -259,12 +287,17 @@ namespace MiscServices {
|
||||
int32_t InputMethodCoreProxy::getKeyboardWindowHeight(int32_t retHeight)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodCoreProxy::getKeyboardWindowHeight");
|
||||
auto remote = Remote();
|
||||
if (remote == nullptr) {
|
||||
IMSA_HILOGI("remote is nullptr");
|
||||
return ErrorCode::ERROR_NULL_POINTER;
|
||||
}
|
||||
MessageParcel data, reply;
|
||||
data.WriteInterfaceToken(GetDescriptor());
|
||||
MessageOption option {
|
||||
MessageOption::TF_SYNC
|
||||
};
|
||||
int32_t status = Remote()->SendRequest(GET_KEYBOARD_WINDOW_HEIGHT, data, reply, option);
|
||||
int32_t status = remote->SendRequest(GET_KEYBOARD_WINDOW_HEIGHT, data, reply, option);
|
||||
if (status != ErrorCode::NO_ERROR) {
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -137,6 +137,7 @@ namespace MiscServices {
|
||||
state_ = ServiceRunningState::STATE_RUNNING;
|
||||
std::string defaultIme = ParaHandle::GetDefaultIme(userId_);
|
||||
StartInputService(defaultIme);
|
||||
StartUserIdListener();
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
|
||||
@@ -182,8 +183,6 @@ namespace MiscServices {
|
||||
|
||||
userId_ = MAIN_USER_ID;
|
||||
setting->Initialize();
|
||||
|
||||
StartUserIdListener();
|
||||
}
|
||||
|
||||
void InputMethodSystemAbility::StartUserIdListener()
|
||||
|
||||
Reference in New Issue
Block a user