mirror of
https://github.com/openharmony/miscservices_inputmethod.git
synced 2026-07-22 08:25:20 -04:00
@@ -18,88 +18,86 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace MiscServices {
|
||||
InputClientStub::InputClientStub()
|
||||
{
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user