mirror of
https://github.com/openharmony/miscservices_inputmethod.git
synced 2026-07-22 00:15:21 -04:00
@@ -22,7 +22,8 @@ using namespace ErrorCode;
|
||||
{
|
||||
}
|
||||
|
||||
int32_t InputClientProxy::onInputReady(int32_t retValue, const sptr<IInputMethodAgent>& agent, const InputChannel* channel)
|
||||
int32_t InputClientProxy::onInputReady(int32_t retValue, const sptr<IInputMethodAgent>& agent,
|
||||
const InputChannel *channel)
|
||||
{
|
||||
IMSA_HILOGI("InputClientProxy::onInputReady");
|
||||
MessageParcel data, reply;
|
||||
|
||||
@@ -18,88 +18,85 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace MiscServices {
|
||||
|
||||
InputClientStub::InputClientStub()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
InputClientStub::~InputClientStub()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int32_t InputClientStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
|
||||
MessageOption &option)
|
||||
{
|
||||
IMSA_HILOGI("InputClientStub::OnRemoteRequest. code = %{public}u", code);
|
||||
auto descriptorToken = data.ReadInterfaceToken();
|
||||
if (descriptorToken != GetDescriptor()) {
|
||||
return ErrorCode::ERROR_STATUS_UNKNOWN_TRANSACTION;
|
||||
InputClientStub::InputClientStub()
|
||||
{
|
||||
}
|
||||
switch (code) {
|
||||
case ON_INPUT_READY: {
|
||||
if (msgHandler == nullptr) {
|
||||
break;
|
||||
}
|
||||
MessageParcel* parcel = new MessageParcel();
|
||||
parcel->WriteInt32(data.ReadInt32());
|
||||
if (data.ReadInt32() > 0) {
|
||||
parcel->WriteRemoteObject(data.ReadRemoteObject());
|
||||
}
|
||||
if (data.ReadInt32() > 0) {
|
||||
parcel->WriteParcelable(data.ReadParcelable<InputChannel>());
|
||||
}
|
||||
|
||||
Message* msg = new Message(MessageID::MSG_ID_ON_INPUT_READY, parcel);
|
||||
msgHandler->SendMessage(msg);
|
||||
break;
|
||||
}
|
||||
case ON_INPUT_RELEASED: {
|
||||
if (msgHandler == nullptr) {
|
||||
break;
|
||||
}
|
||||
MessageParcel* parcel = new MessageParcel();
|
||||
parcel->WriteInt32(data.ReadInt32());
|
||||
Message* msg = new Message(MessageID::MSG_ID_EXIT_SERVICE, parcel);
|
||||
msgHandler->SendMessage(msg);
|
||||
break;
|
||||
}
|
||||
case SET_DISPLAY_MODE: {
|
||||
if (msgHandler == nullptr) {
|
||||
break;
|
||||
}
|
||||
MessageParcel* parcel = new MessageParcel();
|
||||
parcel->WriteInt32(data.ReadInt32());
|
||||
Message* msg = new Message(MessageID::MSG_ID_SET_DISPLAY_MODE, parcel);
|
||||
msgHandler->SendMessage(msg);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
InputClientStub::~InputClientStub()
|
||||
{
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t InputClientStub::onInputReady(int32_t retValue, const sptr<IInputMethodAgent>& agent, const InputChannel* channel)
|
||||
{
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
int32_t InputClientStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
|
||||
MessageOption &option)
|
||||
{
|
||||
IMSA_HILOGI("InputClientStub::OnRemoteRequest. code = %{public}u", code);
|
||||
auto descriptorToken = data.ReadInterfaceToken();
|
||||
if (descriptorToken != GetDescriptor()) {
|
||||
return ErrorCode::ERROR_STATUS_UNKNOWN_TRANSACTION;
|
||||
}
|
||||
switch (code) {
|
||||
case ON_INPUT_READY: {
|
||||
if (msgHandler == nullptr) {
|
||||
break;
|
||||
}
|
||||
MessageParcel *parcel = new MessageParcel();
|
||||
parcel->WriteInt32(data.ReadInt32());
|
||||
if (data.ReadInt32() > 0) {
|
||||
parcel->WriteRemoteObject(data.ReadRemoteObject());
|
||||
}
|
||||
if (data.ReadInt32() > 0) {
|
||||
parcel->WriteParcelable(data.ReadParcelable<InputChannel>());
|
||||
}
|
||||
|
||||
int32_t InputClientStub::onInputReleased(int32_t retValue)
|
||||
{
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
Message *msg = new Message(MessageID::MSG_ID_ON_INPUT_READY, parcel);
|
||||
msgHandler->SendMessage(msg);
|
||||
break;
|
||||
}
|
||||
case ON_INPUT_RELEASED: {
|
||||
if (msgHandler == nullptr) {
|
||||
break;
|
||||
}
|
||||
MessageParcel *parcel = new MessageParcel();
|
||||
parcel->WriteInt32(data.ReadInt32());
|
||||
Message *msg = new Message(MessageID::MSG_ID_EXIT_SERVICE, parcel);
|
||||
msgHandler->SendMessage(msg);
|
||||
break;
|
||||
}
|
||||
case SET_DISPLAY_MODE: {
|
||||
if (msgHandler == nullptr) {
|
||||
break;
|
||||
}
|
||||
MessageParcel *parcel = new MessageParcel();
|
||||
parcel->WriteInt32(data.ReadInt32());
|
||||
Message *msg = new Message(MessageID::MSG_ID_SET_DISPLAY_MODE, parcel);
|
||||
msgHandler->SendMessage(msg);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t InputClientStub::setDisplayMode(int32_t mode)
|
||||
{
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
int32_t InputClientStub::onInputReady(int32_t retValue, const sptr<IInputMethodAgent>& agent,
|
||||
const InputChannel *channel)
|
||||
{
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
|
||||
void InputClientStub::SetHandler(MessageHandler* handler)
|
||||
{
|
||||
msgHandler = handler;
|
||||
}
|
||||
int32_t InputClientStub::onInputReleased(int32_t retValue)
|
||||
{
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t InputClientStub::setDisplayMode(int32_t mode)
|
||||
{
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
|
||||
void InputClientStub::SetHandler(MessageHandler *handler)
|
||||
{
|
||||
msgHandler = handler;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,55 +19,54 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace MiscServices {
|
||||
|
||||
InputDataChannelProxy::InputDataChannelProxy(const sptr<IRemoteObject> &object) : IRemoteProxy<IInputDataChannel>(object)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool InputDataChannelProxy::InsertText(const std::u16string& text)
|
||||
{
|
||||
IMSA_HILOGI("InputDataChannelProxy::InsertText");
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(GetDescriptor());
|
||||
data.WriteString16(text);
|
||||
|
||||
auto ret = Remote()->SendRequest(INSERT_TEXT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return false;
|
||||
InputDataChannelProxy::InputDataChannelProxy(const sptr<IRemoteObject> &object)
|
||||
: IRemoteProxy<IInputDataChannel>(object)
|
||||
{
|
||||
}
|
||||
auto result = reply.ReadBool();
|
||||
return result;
|
||||
}
|
||||
|
||||
bool InputDataChannelProxy::DeleteBackward(int32_t length)
|
||||
{
|
||||
IMSA_HILOGI("InputDataChannelProxy::DeleteBackward");
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(GetDescriptor());
|
||||
data.WriteInt32(length);
|
||||
bool InputDataChannelProxy::InsertText(const std::u16string& text)
|
||||
{
|
||||
IMSA_HILOGI("InputDataChannelProxy::InsertText");
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(GetDescriptor());
|
||||
data.WriteString16(text);
|
||||
|
||||
auto ret = Remote()->SendRequest(DELETE_BACKWARD, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return false;
|
||||
auto ret = Remote()->SendRequest(INSERT_TEXT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
auto result = reply.ReadBool();
|
||||
return result;
|
||||
}
|
||||
auto result = reply.ReadBool();
|
||||
return result;
|
||||
}
|
||||
|
||||
void InputDataChannelProxy::Close()
|
||||
{
|
||||
IMSA_HILOGI("InputDataChannelProxy::Close");
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(GetDescriptor());
|
||||
bool InputDataChannelProxy::DeleteBackward(int32_t length)
|
||||
{
|
||||
IMSA_HILOGI("InputDataChannelProxy::DeleteBackward");
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(GetDescriptor());
|
||||
data.WriteInt32(length);
|
||||
|
||||
auto ret = Remote()->SendRequest(CLOSE, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
|
||||
auto ret = Remote()->SendRequest(DELETE_BACKWARD, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return false;
|
||||
}
|
||||
auto result = reply.ReadBool();
|
||||
return result;
|
||||
}
|
||||
|
||||
void InputDataChannelProxy::Close()
|
||||
{
|
||||
IMSA_HILOGI("InputDataChannelProxy::Close");
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
data.WriteInterfaceToken(GetDescriptor());
|
||||
|
||||
auto ret = Remote()->SendRequest(CLOSE, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,82 +17,81 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace MiscServices {
|
||||
InputDataChannelStub::InputDataChannelStub() : msgHandler(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
InputDataChannelStub::~InputDataChannelStub()
|
||||
{
|
||||
if (msgHandler != nullptr) {
|
||||
delete msgHandler;
|
||||
InputDataChannelStub::InputDataChannelStub() : msgHandler(nullptr)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
int32_t InputDataChannelStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
|
||||
MessageOption &option)
|
||||
{
|
||||
IMSA_HILOGI("InputDataChannelStub::OnRemoteRequest code = %{public}d", code);
|
||||
auto descriptorToken = data.ReadInterfaceToken();
|
||||
if (descriptorToken != GetDescriptor()) {
|
||||
return ErrorCode::ERROR_STATUS_UNKNOWN_TRANSACTION;
|
||||
}
|
||||
switch (code) {
|
||||
case INSERT_TEXT: {
|
||||
auto text = data.ReadString16();
|
||||
InsertText(text);
|
||||
break;
|
||||
InputDataChannelStub::~InputDataChannelStub()
|
||||
{
|
||||
if (msgHandler != nullptr) {
|
||||
delete msgHandler;
|
||||
}
|
||||
case DELETE_BACKWARD: {
|
||||
auto length = data.ReadInt32();
|
||||
DeleteBackward(length);
|
||||
break;
|
||||
}
|
||||
|
||||
int32_t InputDataChannelStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
|
||||
MessageOption &option)
|
||||
{
|
||||
IMSA_HILOGI("InputDataChannelStub::OnRemoteRequest code = %{public}d", code);
|
||||
auto descriptorToken = data.ReadInterfaceToken();
|
||||
if (descriptorToken != GetDescriptor()) {
|
||||
return ErrorCode::ERROR_STATUS_UNKNOWN_TRANSACTION;
|
||||
}
|
||||
case CLOSE: {
|
||||
Close();
|
||||
break;
|
||||
switch (code) {
|
||||
case INSERT_TEXT: {
|
||||
auto text = data.ReadString16();
|
||||
InsertText(text);
|
||||
break;
|
||||
}
|
||||
case DELETE_BACKWARD: {
|
||||
auto length = data.ReadInt32();
|
||||
DeleteBackward(length);
|
||||
break;
|
||||
}
|
||||
case CLOSE: {
|
||||
Close();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
}
|
||||
default:
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
return NO_ERROR;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
bool InputDataChannelStub::InsertText(const std::u16string& text)
|
||||
{
|
||||
IMSA_HILOGI("InputDataChannelStub::InsertText");
|
||||
if (msgHandler != nullptr) {
|
||||
MessageParcel* parcel = new MessageParcel;
|
||||
parcel->WriteString16(text);
|
||||
Message* msg = new Message(MessageID::MSG_ID_INSERT_CHAR, parcel);
|
||||
msgHandler->SendMessage(msg);
|
||||
IMSA_HILOGI("InputDataChannelStub::InsertText return true");
|
||||
return true;
|
||||
bool InputDataChannelStub::InsertText(const std::u16string& text)
|
||||
{
|
||||
IMSA_HILOGI("InputDataChannelStub::InsertText");
|
||||
if (msgHandler != nullptr) {
|
||||
MessageParcel *parcel = new MessageParcel;
|
||||
parcel->WriteString16(text);
|
||||
Message *msg = new Message(MessageID::MSG_ID_INSERT_CHAR, parcel);
|
||||
msgHandler->SendMessage(msg);
|
||||
IMSA_HILOGI("InputDataChannelStub::InsertText return true");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InputDataChannelStub::DeleteBackward(int32_t length)
|
||||
{
|
||||
IMSA_HILOGI("InputDataChannelStub::DeleteBackward");
|
||||
if (msgHandler != nullptr) {
|
||||
MessageParcel* parcel = new MessageParcel;
|
||||
parcel->WriteInt32(length);
|
||||
Message* msg = new Message(MessageID::MSG_ID_DELETE_BACKWARD, parcel);
|
||||
msgHandler->SendMessage(msg);
|
||||
return true;
|
||||
bool InputDataChannelStub::DeleteBackward(int32_t length)
|
||||
{
|
||||
IMSA_HILOGI("InputDataChannelStub::DeleteBackward");
|
||||
if (msgHandler != nullptr) {
|
||||
MessageParcel *parcel = new MessageParcel;
|
||||
parcel->WriteInt32(length);
|
||||
Message *msg = new Message(MessageID::MSG_ID_DELETE_BACKWARD, parcel);
|
||||
msgHandler->SendMessage(msg);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void InputDataChannelStub::Close()
|
||||
{
|
||||
void InputDataChannelStub::Close()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void InputDataChannelStub::SetHandler(MessageHandler* handler)
|
||||
{
|
||||
msgHandler = handler;
|
||||
}
|
||||
void InputDataChannelStub::SetHandler(MessageHandler *handler)
|
||||
{
|
||||
msgHandler = handler;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,10 +95,10 @@ using namespace MessageID;
|
||||
void InputMethodController::WorkThread()
|
||||
{
|
||||
while(1) {
|
||||
Message* msg = msgHandler->GetMessage();
|
||||
Message *msg = msgHandler->GetMessage();
|
||||
switch(msg->msgId_) {
|
||||
case MSG_ID_INSERT_CHAR:{
|
||||
MessageParcel* data = msg->msgContent_;
|
||||
MessageParcel *data = msg->msgContent_;
|
||||
std::u16string text = data->ReadString16();
|
||||
if(textListener != nullptr){
|
||||
textListener->InsertText(text);
|
||||
@@ -106,7 +106,7 @@ using namespace MessageID;
|
||||
break;
|
||||
}
|
||||
case MSG_ID_DELETE_BACKWARD:{
|
||||
MessageParcel* data = msg->msgContent_;
|
||||
MessageParcel *data = msg->msgContent_;
|
||||
int32_t length = data->ReadInt32();
|
||||
if(textListener != nullptr){
|
||||
textListener->DeleteBackward(length);
|
||||
@@ -114,13 +114,13 @@ using namespace MessageID;
|
||||
break;
|
||||
}
|
||||
case MSG_ID_SET_DISPLAY_MODE:{
|
||||
MessageParcel* data = msg->msgContent_;
|
||||
MessageParcel *data = msg->msgContent_;
|
||||
int32_t ret = data->ReadInt32();
|
||||
IMSA_HILOGI("MSG_ID_SET_DISPLAY_MODE : %{public}d", ret);
|
||||
break;
|
||||
}
|
||||
case MSG_ID_ON_INPUT_READY:{
|
||||
MessageParcel* data = msg->msgContent_;
|
||||
MessageParcel *data = msg->msgContent_;
|
||||
int32_t ret = data->ReadInt32();
|
||||
if(ret != ErrorCode::NO_ERROR) {
|
||||
if (textListener != nullptr){
|
||||
@@ -137,7 +137,7 @@ using namespace MessageID;
|
||||
break;
|
||||
}
|
||||
case MSG_ID_EXIT_SERVICE:{
|
||||
MessageParcel* data = msg->msgContent_;
|
||||
MessageParcel *data = msg->msgContent_;
|
||||
int32_t ret = data->ReadInt32();
|
||||
textListener = nullptr;
|
||||
IMSA_HILOGI("MSG_ID_EXIT_SERVICE : %{public}d", ret);
|
||||
@@ -174,7 +174,8 @@ using namespace MessageID;
|
||||
ReleaseInput(mClient);
|
||||
}
|
||||
|
||||
void InputMethodController::PrepareInput(int32_t displayId,sptr<InputClientStub> &client,sptr<InputDataChannelStub> &channel,InputAttribute &attribute)
|
||||
void InputMethodController::PrepareInput(int32_t displayId, sptr<InputClientStub> &client,
|
||||
sptr<InputDataChannelStub> &channel, InputAttribute &attribute)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodController::PrepareInput");
|
||||
if(mImms == nullptr){
|
||||
@@ -233,13 +234,13 @@ using namespace MessageID;
|
||||
mImms->stopInput(data);
|
||||
}
|
||||
|
||||
void InputMethodController::OnRemoteSaDied(const wptr<IRemoteObject> &remote) {
|
||||
void InputMethodController::OnRemoteSaDied(const wptr<IRemoteObject> &remote)
|
||||
{
|
||||
mImms = GetImsaProxy();
|
||||
}
|
||||
|
||||
ImsaDeathRecipient::ImsaDeathRecipient()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ImsaDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &object)
|
||||
|
||||
@@ -17,87 +17,85 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace MiscServices {
|
||||
using namespace ErrorCode;
|
||||
|
||||
InputMethodSystemAbilityProxy::InputMethodSystemAbilityProxy(const sptr<IRemoteObject> &object)
|
||||
: IRemoteProxy<IInputMethodSystemAbility>(object)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void InputMethodSystemAbilityProxy::prepareInput(MessageParcel& data)
|
||||
{
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
auto ret = Remote()->SendRequest(PREPARE_INPUT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::prepareInput SendRequest failed");
|
||||
return;
|
||||
using namespace ErrorCode;
|
||||
InputMethodSystemAbilityProxy::InputMethodSystemAbilityProxy(const sptr<IRemoteObject> &object)
|
||||
: IRemoteProxy<IInputMethodSystemAbility>(object)
|
||||
{
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::prepareInput reply failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
void InputMethodSystemAbilityProxy::prepareInput(MessageParcel& data)
|
||||
{
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
void InputMethodSystemAbilityProxy::releaseInput(MessageParcel& data)
|
||||
{
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
auto ret = Remote()->SendRequest(PREPARE_INPUT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::prepareInput SendRequest failed");
|
||||
return;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(RELEASE_INPUT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::releaseInput SendRequest failed");
|
||||
return;
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::prepareInput reply failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::releaseInput reply failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
void InputMethodSystemAbilityProxy::releaseInput(MessageParcel& data)
|
||||
{
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
void InputMethodSystemAbilityProxy::startInput(MessageParcel& data)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::startInput");
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
auto ret = Remote()->SendRequest(RELEASE_INPUT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::releaseInput SendRequest failed");
|
||||
return;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(START_INPUT,data,reply,option);
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::startInput SendRequest failed");
|
||||
return;
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::releaseInput reply failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::startInput reply failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
void InputMethodSystemAbilityProxy::startInput(MessageParcel& data)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::startInput");
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
void InputMethodSystemAbilityProxy::stopInput(MessageParcel& data)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::stopInput");
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
auto ret = Remote()->SendRequest(START_INPUT,data,reply,option);
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::startInput SendRequest failed");
|
||||
return;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(STOP_INPUT,data,reply,option);
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::stopInput SendRequest failed");
|
||||
return;
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::startInput reply failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::stopInput reply failed");
|
||||
return;
|
||||
void InputMethodSystemAbilityProxy::stopInput(MessageParcel& data)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::stopInput");
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
|
||||
auto ret = Remote()->SendRequest(STOP_INPUT,data,reply,option);
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::stopInput SendRequest failed");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::stopInput reply failed");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::setInputMethodCore(sptr<IInputMethodCore> &core)
|
||||
{
|
||||
@@ -107,12 +105,14 @@ void InputMethodSystemAbilityProxy::stopInput(MessageParcel& data)
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::setInputMethodCore inputDataChannel is nullptr");
|
||||
}
|
||||
auto remote = Remote();
|
||||
if (remote == nullptr)
|
||||
if (remote == nullptr) {
|
||||
return -1;
|
||||
}
|
||||
MessageParcel data;
|
||||
if (!(data.WriteInterfaceToken(GetDescriptor())
|
||||
&& data.WriteRemoteObject(core->AsObject())))
|
||||
&& data.WriteRemoteObject(core->AsObject()))) {
|
||||
return -1;
|
||||
}
|
||||
MessageParcel reply;
|
||||
MessageOption option { MessageOption::TF_SYNC };
|
||||
|
||||
@@ -121,290 +121,288 @@ void InputMethodSystemAbilityProxy::stopInput(MessageParcel& data)
|
||||
return status;
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::Prepare(int32_t displayId, sptr<InputClientStub> &client, sptr<InputDataChannelStub> &channel, InputAttribute &attribute)
|
||||
{
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
int32_t InputMethodSystemAbilityProxy::Prepare(int32_t displayId, sptr<InputClientStub> &client,
|
||||
sptr<InputDataChannelStub> &channel, InputAttribute &attribute)
|
||||
{
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
if (!(data.WriteInt32(displayId)
|
||||
&& data.WriteRemoteObject(client->AsObject())
|
||||
&& data.WriteRemoteObject(channel->AsObject())
|
||||
&& data.WriteParcelable(&attribute))) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(PREPARE_INPUT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
if (!(data.WriteInt32(displayId)
|
||||
&& data.WriteRemoteObject(client->AsObject())
|
||||
&& data.WriteRemoteObject(channel->AsObject())
|
||||
&& data.WriteParcelable(&attribute))) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
int32_t InputMethodSystemAbilityProxy::Release(sptr<InputClientStub> &client)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::Release");
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(PREPARE_INPUT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
if (!data.WriteRemoteObject(client->AsObject().GetRefPtr())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(RELEASE_INPUT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
int32_t InputMethodSystemAbilityProxy::Start(sptr<InputClientStub> &client)
|
||||
{
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
if (!data.WriteRemoteObject(client->AsObject().GetRefPtr())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(START_INPUT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
int32_t InputMethodSystemAbilityProxy::Stop(sptr<InputClientStub> &client)
|
||||
{
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::Release(sptr<InputClientStub> &client)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodSystemAbilityProxy::Release");
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
if (!data.WriteRemoteObject(client->AsObject().GetRefPtr())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(STOP_INPUT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
if (!data.WriteRemoteObject(client->AsObject().GetRefPtr())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
int32_t InputMethodSystemAbilityProxy::getDisplayMode(int32_t *retMode)
|
||||
{
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(GET_DISPLAY_MODE, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!reply.ReadInt32(*retMode)) {
|
||||
return ERROR_STATUS_BAD_VALUE;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(RELEASE_INPUT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
int32_t InputMethodSystemAbilityProxy::getKeyboardWindowHeight(int32_t retHeight)
|
||||
{
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(GET_KEYBOARD_WINDOW_HEIGHT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!reply.ReadInt32(retHeight)) {
|
||||
return ERROR_STATUS_BAD_VALUE;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
int32_t InputMethodSystemAbilityProxy::getCurrentKeyboardType(KeyboardType *retType)
|
||||
{
|
||||
if (retType == nullptr) {
|
||||
return ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(GET_CURRENT_KEYBOARD_TYPE, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
KeyboardType *keyType = reply.ReadParcelable<KeyboardType>();
|
||||
*retType = *keyType;
|
||||
delete keyType;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
int32_t InputMethodSystemAbilityProxy::listInputMethodEnabled(std::vector<InputMethodProperty*> *properties)
|
||||
{
|
||||
if (properties == nullptr) {
|
||||
return ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::Start(sptr<InputClientStub> &client)
|
||||
{
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(LIST_INPUT_METHOD_ENABLED, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto size = reply.ReadInt32();
|
||||
while (size > 0) {
|
||||
InputMethodProperty *imp = reply.ReadParcelable<InputMethodProperty>();
|
||||
properties->push_back(imp);
|
||||
size--;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
if (!data.WriteRemoteObject(client->AsObject().GetRefPtr())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(START_INPUT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
int32_t InputMethodSystemAbilityProxy::listInputMethod(std::vector<InputMethodProperty*> *properties)
|
||||
{
|
||||
if (properties == nullptr) {
|
||||
return ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(LIST_INPUT_METHOD, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto size = reply.ReadInt32();
|
||||
|
||||
while (size > 0) {
|
||||
InputMethodProperty *imp = reply.ReadParcelable<InputMethodProperty>();
|
||||
properties->push_back(imp);
|
||||
size--;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
int32_t InputMethodSystemAbilityProxy::listKeyboardType(const std::u16string& imeId,
|
||||
std::vector<KeyboardType*> *types)
|
||||
{
|
||||
if (types == nullptr) {
|
||||
return ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!(data.WriteInterfaceToken(GetDescriptor()) && data.WriteString16(imeId))) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(LIST_KEYBOARD_TYPE, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto size = reply.ReadInt32();
|
||||
while (size > 0) {
|
||||
KeyboardType *kt = reply.ReadParcelable<KeyboardType>();
|
||||
types->push_back(kt);
|
||||
size--;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::Stop(sptr<InputClientStub> &client)
|
||||
{
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
if (!data.WriteRemoteObject(client->AsObject().GetRefPtr())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(STOP_INPUT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::getDisplayMode(int32_t *retMode)
|
||||
{
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(GET_DISPLAY_MODE, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!reply.ReadInt32(*retMode)) {
|
||||
return ERROR_STATUS_BAD_VALUE;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::getKeyboardWindowHeight(int32_t *retHeight)
|
||||
{
|
||||
if (retHeight == nullptr) {
|
||||
return ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(GET_KEYBOARD_WINDOW_HEIGHT, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!reply.ReadInt32(*retHeight)) {
|
||||
return ERROR_STATUS_BAD_VALUE;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::getCurrentKeyboardType(KeyboardType* retType)
|
||||
{
|
||||
if (retType == nullptr) {
|
||||
return ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(GET_CURRENT_KEYBOARD_TYPE, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
KeyboardType* keyType = reply.ReadParcelable<KeyboardType>();
|
||||
*retType = *keyType;
|
||||
delete keyType;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::listInputMethodEnabled(std::vector<InputMethodProperty*> *properties)
|
||||
{
|
||||
if (properties == nullptr) {
|
||||
return ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(LIST_INPUT_METHOD_ENABLED, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto size = reply.ReadInt32();
|
||||
while (size > 0) {
|
||||
InputMethodProperty* imp = reply.ReadParcelable<InputMethodProperty>();
|
||||
properties->push_back(imp);
|
||||
size--;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::listInputMethod(std::vector<InputMethodProperty*> *properties)
|
||||
{
|
||||
if (properties == nullptr) {
|
||||
return ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(LIST_INPUT_METHOD, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto size = reply.ReadInt32();
|
||||
|
||||
while (size > 0) {
|
||||
InputMethodProperty* imp = reply.ReadParcelable<InputMethodProperty>();
|
||||
properties->push_back(imp);
|
||||
size--;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::listKeyboardType(const std::u16string& imeId, std::vector<KeyboardType*> *types)
|
||||
{
|
||||
if (types == nullptr) {
|
||||
return ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
MessageParcel data, reply;
|
||||
MessageOption option;
|
||||
|
||||
if (!(data.WriteInterfaceToken(GetDescriptor()) && data.WriteString16(imeId))) {
|
||||
return ERROR_EX_PARCELABLE;
|
||||
}
|
||||
|
||||
auto ret = Remote()->SendRequest(LIST_KEYBOARD_TYPE, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
return ERROR_STATUS_FAILED_TRANSACTION;
|
||||
}
|
||||
|
||||
ret = reply.ReadInt32();
|
||||
if (ret != NO_ERROR) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto size = reply.ReadInt32();
|
||||
while (size > 0) {
|
||||
KeyboardType* kt = reply.ReadParcelable<KeyboardType>();
|
||||
types->push_back(kt);
|
||||
size--;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user