fix warning

Signed-off-by: zhouyongfei <zhouyongfei@huawei.com>
This commit is contained in:
zhouyongfei
2021-09-23 20:57:43 +08:00
parent 4905aca179
commit a8eee40e32
75 changed files with 3307 additions and 3247 deletions
@@ -27,21 +27,21 @@
*/
namespace OHOS {
namespace MiscServices {
class IInputClient : public IRemoteBroker {
public:
enum {
ON_INPUT_READY = 0,
ON_INPUT_RELEASED ,
SET_DISPLAY_MODE ,
};
class IInputClient : public IRemoteBroker {
public:
enum {
ON_INPUT_READY = 0,
ON_INPUT_RELEASED,
SET_DISPLAY_MODE,
};
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.miscservices.inputmethod.InputClient");
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.miscservices.inputmethod.InputClient");
virtual int32_t onInputReady(int32_t retValue, const sptr<IInputMethodAgent>& agent, const InputChannel* channel) = 0;
virtual int32_t onInputReleased(int32_t retValue) = 0;
virtual int32_t setDisplayMode(int32_t mode) = 0;
};
virtual int32_t onInputReady(int32_t retValue, const sptr<IInputMethodAgent>& agent,
const InputChannel *channel) = 0;
virtual int32_t onInputReleased(int32_t retValue) = 0;
virtual int32_t setDisplayMode(int32_t mode) = 0;
};
}
}
#endif // FM_IMMS_PROJECT_IINPUTCLIENT_H
#endif // FM_IMMS_PROJECT_IINPUTCLIENT_H
@@ -25,7 +25,7 @@
*/
namespace OHOS {
namespace MiscServices {
class IInputDataChannel: public IRemoteBroker {
class IInputDataChannel : public IRemoteBroker {
public:
enum {
INSERT_TEXT = 0,
@@ -22,15 +22,13 @@
namespace OHOS {
namespace MiscServices {
class InputClientProxy : public IRemoteProxy<IInputClient>
{
class InputClientProxy : public IRemoteProxy<IInputClient> {
public:
explicit InputClientProxy(const sptr<IRemoteObject> &object);
~InputClientProxy() = default;
DISALLOW_COPY_AND_MOVE(InputClientProxy);
int32_t onInputReady(int32_t retValue, const sptr<IInputMethodAgent>& agent, const InputChannel* channel) override;
int32_t onInputReady(int32_t retValue, const sptr<IInputMethodAgent>& agent, const InputChannel *channel) override;
int32_t onInputReleased(int32_t retValue) override;
int32_t setDisplayMode(int32_t mode) override;
@@ -29,13 +29,13 @@ public:
int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
InputClientStub();
~InputClientStub();
void SetHandler(MessageHandler* handler);
void SetHandler(MessageHandler *handler);
int32_t onInputReady(int32_t retValue, const sptr<IInputMethodAgent>& agent, const InputChannel* channel) override;
int32_t onInputReady(int32_t retValue, const sptr<IInputMethodAgent>& agent, const InputChannel *channel) override;
int32_t onInputReleased(int32_t retValue) override;
int32_t setDisplayMode(int32_t mode) override;
private:
MessageHandler* msgHandler = nullptr;
MessageHandler *msgHandler = nullptr;
};
}
}
@@ -13,8 +13,6 @@
* limitations under the License.
*/
#ifndef FM_IMC_PROJECT_INPUTDATACHANNELPROXY_H
#define FM_IMC_PROJECT_INPUTDATACHANNELPROXY_H
@@ -23,21 +21,19 @@
namespace OHOS {
namespace MiscServices {
class InputDataChannelProxy : public IRemoteProxy<IInputDataChannel> {
public:
explicit InputDataChannelProxy(const sptr<IRemoteObject> &object);
~InputDataChannelProxy() = default;
DISALLOW_COPY_AND_MOVE(InputDataChannelProxy);
class InputDataChannelProxy : public IRemoteProxy<IInputDataChannel>
{
public:
explicit InputDataChannelProxy(const sptr<IRemoteObject> &object);
~InputDataChannelProxy() = default;
DISALLOW_COPY_AND_MOVE(InputDataChannelProxy);
bool InsertText(const std::u16string& text) override;
bool DeleteBackward(int32_t length) override;
void Close() override;
bool InsertText(const std::u16string& text) override;
bool DeleteBackward(int32_t length) override;
void Close() override;
private:
static inline BrokerDelegator<InputDataChannelProxy> delegator_;
};
private:
static inline BrokerDelegator<InputDataChannelProxy> delegator_;
};
}
}
#endif
@@ -29,13 +29,13 @@ public:
int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
InputDataChannelStub();
~InputDataChannelStub();
void SetHandler(MessageHandler* handler);
void SetHandler(MessageHandler *handler);
bool InsertText(const std::u16string& text) override;
bool DeleteBackward(int32_t length) override;
void Close() override;
private:
MessageHandler* msgHandler;
MessageHandler *msgHandler;
};
}
}
@@ -17,7 +17,6 @@
#ifndef FM_IMC_PROJECT_INPUTMETHODCONTROLLER_H
#define FM_IMC_PROJECT_INPUTMETHODCONTROLLER_H
//#include "refbase.h"
#include <mutex>
#include <thread>
#include "input_data_channel_stub.h"
@@ -30,7 +29,6 @@
namespace OHOS {
namespace MiscServices {
class OnTextChangedListener : public virtual RefBase {
public:
virtual void InsertText(const std::u16string& text) = 0;
@@ -60,7 +58,8 @@ namespace MiscServices {
bool Initialize();
sptr<InputMethodSystemAbilityProxy> GetImsaProxy();
void PrepareInput(int32_t displayId,sptr<InputClientStub> &client,sptr<InputDataChannelStub> &channel,InputAttribute &attribute);
void PrepareInput(int32_t displayId, sptr<InputClientStub> &client, sptr<InputDataChannelStub> &channel,
InputAttribute &attribute);
void StartInput(sptr<InputClientStub> &client);
void StopInput(sptr<InputClientStub> &client);
void ReleaseInput(sptr<InputClientStub> &client);
@@ -71,13 +70,13 @@ namespace MiscServices {
sptr<InputMethodSystemAbilityProxy> mImms;
sptr<ImsaDeathRecipient> deathRecipient_;
sptr<InputMethodAgentProxy> mAgent;
OnTextChangedListener* textListener;
OnTextChangedListener *textListener;
InputAttribute mAttribute;
static std::mutex instanceLock_;
static sptr<InputMethodController> instance_;
std::thread workThreadHandler;
MessageHandler* msgHandler;
MessageHandler *msgHandler;
};
}
}
@@ -13,7 +13,6 @@
* limitations under the License.
*/
#ifndef FM_IMC_PROJECT_INPUTMETHODSYSTEMABILITYPROXY_H
#define FM_IMC_PROJECT_INPUTMETHODSYSTEMABILITYPROXY_H
@@ -30,35 +29,34 @@
namespace OHOS {
namespace MiscServices {
class InputMethodSystemAbilityProxy : public IRemoteProxy<IInputMethodSystemAbility> {
public:
explicit InputMethodSystemAbilityProxy(const sptr<IRemoteObject> &object);
~InputMethodSystemAbilityProxy() = default;
DISALLOW_COPY_AND_MOVE(InputMethodSystemAbilityProxy);
class InputMethodSystemAbilityProxy : public IRemoteProxy<IInputMethodSystemAbility>
{
public:
explicit InputMethodSystemAbilityProxy(const sptr<IRemoteObject> &object);
~InputMethodSystemAbilityProxy() = default;
DISALLOW_COPY_AND_MOVE(InputMethodSystemAbilityProxy);
virtual void prepareInput(MessageParcel& data) override;
virtual void releaseInput(MessageParcel& data) override;
virtual void startInput(MessageParcel& data) override;
virtual void stopInput(MessageParcel& data) override;
virtual int32_t setInputMethodCore(sptr<IInputMethodCore> &core) override;
virtual void prepareInput(MessageParcel& data) override;
virtual void releaseInput(MessageParcel& data) override;
virtual void startInput(MessageParcel& data) override;
virtual void stopInput(MessageParcel& data) override;
virtual int32_t setInputMethodCore(sptr<IInputMethodCore> &core) override;
int32_t Prepare(int32_t displayId, sptr<InputClientStub> &client, sptr<InputDataChannelStub> &channel,
InputAttribute &attribute);
int32_t Release(sptr<InputClientStub> &client);
int32_t Start(sptr<InputClientStub> &client);
int32_t Stop(sptr<InputClientStub> &client);
int32_t Prepare(int32_t displayId, sptr<InputClientStub> &client, sptr<InputDataChannelStub> &channel, InputAttribute &attribute);
int32_t Release(sptr<InputClientStub> &client);
int32_t Start(sptr<InputClientStub> &client);
int32_t Stop(sptr<InputClientStub> &client);
virtual int32_t getDisplayMode(int32_t *retMode) override;
virtual int32_t getKeyboardWindowHeight(int32_t retHeight) override;
virtual int32_t getCurrentKeyboardType(KeyboardType *retType) override;
virtual int32_t listInputMethodEnabled(std::vector<InputMethodProperty*> *properties) override;
virtual int32_t listInputMethod(std::vector<InputMethodProperty*> *properties) override;
virtual int32_t listKeyboardType(const std::u16string& imeId, std::vector<KeyboardType*> *types) override;
virtual int32_t getDisplayMode(int32_t *retMode) override;
virtual int32_t getKeyboardWindowHeight(int32_t *retHeight) override;
virtual int32_t getCurrentKeyboardType(KeyboardType* retType) override;
virtual int32_t listInputMethodEnabled(std::vector<InputMethodProperty*> *properties) override;
virtual int32_t listInputMethod(std::vector<InputMethodProperty*> *properties) override;
virtual int32_t listKeyboardType(const std::u16string& imeId, std::vector<KeyboardType*> *types) override;
private:
static inline BrokerDelegator<InputMethodSystemAbilityProxy> delegator_;
};
private:
static inline BrokerDelegator<InputMethodSystemAbilityProxy> delegator_;
};
}
}
#endif
@@ -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;
}
}
}