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
+77 -79
View File
@@ -34,17 +34,17 @@ using BRemoteObject = IPCObjectStub;
#define INPUTMETHOD_DEBUG 0
#define LOG_INFO(fmt, args...) \
LogTimeStamp();printf("I %s:%d %s - " fmt, basename(__FILE__), __LINE__, __FUNCTION__, ##args)
LogTimeStamp(); printf("I %s:%d %s - " fmt, basename(__FILE__), __LINE__, __FUNCTION__, ##args)
#define LOG_ERROR(fmt, args...) \
LogTimeStamp();printf("E %s:%d %s - " fmt, basename(__FILE__), __LINE__, __FUNCTION__, ##args)
LogTimeStamp(); printf("E %s:%d %s - " fmt, basename(__FILE__), __LINE__, __FUNCTION__, ##args)
#define LOG_WARNING(fmt, args...) \
LogTimeStamp();printf("W %s:%d %s - " fmt, basename(__FILE__), __LINE__, __FUNCTION__, ##args)
LogTimeStamp(); printf("W %s:%d %s - " fmt, basename(__FILE__), __LINE__, __FUNCTION__, ##args)
#if DEBUG
#define LOG_DEBUG(fmt, args...) \
LogTimeStamp();printf("D %s:%d %s - " fmt, basename(__FILE__), __LINE__, __FUNCTION__, ##args)
LogTimeStamp(); printf("D %s:%d %s - " fmt, basename(__FILE__), __LINE__, __FUNCTION__, ##args)
#else
#define LOG_DEBUG(fmt, args...)
#endif
@@ -52,100 +52,99 @@ using BRemoteObject = IPCObjectStub;
void LogTimeStamp();
namespace CommonEvent {
//! the events handled in input method management system
// the events handled in input method management system
enum {
COMMON_EVENT_USER_STARTED = 10001, /*!< a user is started. */
COMMON_EVENT_USER_STOPPED = 10002, /*!< a user is stopped. */
COMMON_EVENT_USER_UNLOCKED = 10003, /*!< a user is unlocked. */
COMMON_EVENT_USER_LOCKED = 10004, /*!< a user is locked. */
COMMON_EVENT_SETTING_CHANGED = 10005, /*!< input method setting data is changed. */
COMMON_EVENT_PACKAGE_ADDED = 10006, /*!< a package is installed. */
COMMON_EVENT_PACKAGE_REMOVED = 10007, /*!< a package is removed */
COMMON_EVENT_USER_STARTED = 10001, // a user is started.
COMMON_EVENT_USER_STOPPED = 10002, // a user is stopped.
COMMON_EVENT_USER_UNLOCKED = 10003, // a user is unlocked.
COMMON_EVENT_USER_LOCKED = 10004, // a user is locked.
COMMON_EVENT_SETTING_CHANGED = 10005, // input method setting data is changed.
COMMON_EVENT_PACKAGE_ADDED = 10006, // a package is installed.
COMMON_EVENT_PACKAGE_REMOVED = 10007, // a package is removed
};
};
//! User State
// User State
namespace UserState {
/*! The states of a user in the system. */
// The states of a user in the system.
enum {
USER_STATE_NOT_AVAILABLE = -1,
USER_STATE_STARTED = 0, /*!< a user is started. */
USER_STATE_UNLOCKED, /*!< a user is unlocked. */
USER_STATE_STARTED = 0, // a user is started.
USER_STATE_UNLOCKED, // a user is unlocked.
};
};
//! Error Code
// Error Code
namespace ErrorCode {
/*! Error Code definition in the input method management system */
// Error Code definition in the input method management system
enum {
ERROR_STATUS_UNKNOWN_ERROR = (-2147483647 - 1), //!< unknown error
ERROR_STATUS_NO_MEMORY = -ENOMEM, //!< no memory
ERROR_STATUS_INVALID_OPERATION = -ENOSYS, //!< invalid operation
ERROR_STATUS_BAD_VALUE = -EINVAL, //!< bad value
ERROR_STATUS_BAD_TYPE = ERROR_STATUS_UNKNOWN_ERROR+1, //!< bad type
ERROR_STATUS_NAME_NOT_FOUND = -ENOENT, //!< name not found
ERROR_STATUS_PERMISSION_DENIED = -EPERM, //!< permission denied
ERROR_STATUS_NO_INIT = -ENODEV, //!< no init
ERROR_STATUS_ALREADY_EXISTS = -EEXIST, //!< already exist
ERROR_STATUS_DEAD_OBJECT = -EPIPE, //!< dead object
ERROR_STATUS_FAILED_TRANSACTION = ERROR_STATUS_UNKNOWN_ERROR+2, //!< failed transaction
ERROR_STATUS_BAD_INDEX = -EOVERFLOW, //!< bad index
ERROR_STATUS_NOT_ENOUGH_DATA = -ENODATA, //!< not enough data
ERROR_STATUS_WOULD_BLOCK = -EWOULDBLOCK, //!< would block
ERROR_STATUS_TIMED_OUT = -ETIMEDOUT, //!< time out
ERROR_STATUS_UNKNOWN_TRANSACTION = -EBADMSG, //!< unknown transaction
ERROR_STATUS_FDS_NOT_ALLOWED = ERROR_STATUS_UNKNOWN_ERROR+7, //!< fds not allowed
ERROR_STATUS_UNEXPECTED_NULL = ERROR_STATUS_UNKNOWN_ERROR+8, //!< unexpected null,
ERROR_STATUS_UNKNOWN_ERROR = (-2147483647 - 1), // unknown error
ERROR_STATUS_NO_MEMORY = -ENOMEM, // no memory
ERROR_STATUS_INVALID_OPERATION = -ENOSYS, // invalid operation
ERROR_STATUS_BAD_VALUE = -EINVAL, // bad value
ERROR_STATUS_BAD_TYPE = ERROR_STATUS_UNKNOWN_ERROR + 1, // bad type
ERROR_STATUS_NAME_NOT_FOUND = -ENOENT, // name not found
ERROR_STATUS_PERMISSION_DENIED = -EPERM, // permission denied
ERROR_STATUS_NO_INIT = -ENODEV, // no init
ERROR_STATUS_ALREADY_EXISTS = -EEXIST, // already exist
ERROR_STATUS_DEAD_OBJECT = -EPIPE, // dead object
ERROR_STATUS_FAILED_TRANSACTION = ERROR_STATUS_UNKNOWN_ERROR + 2, // failed transaction
ERROR_STATUS_BAD_INDEX = -EOVERFLOW, // bad index
ERROR_STATUS_NOT_ENOUGH_DATA = -ENODATA, // not enough data
ERROR_STATUS_WOULD_BLOCK = -EWOULDBLOCK, // would block
ERROR_STATUS_TIMED_OUT = -ETIMEDOUT, // time out
ERROR_STATUS_UNKNOWN_TRANSACTION = -EBADMSG, // unknown transaction
ERROR_STATUS_FDS_NOT_ALLOWED = ERROR_STATUS_UNKNOWN_ERROR + 7, // fds not allowed
ERROR_STATUS_UNEXPECTED_NULL = ERROR_STATUS_UNKNOWN_ERROR + 8, // unexpected null,
// binder exception error code from Status.h
ERROR_EX_ILLEGAL_ARGUMENT = -3, //!< illegal argument exception
ERROR_EX_NULL_POINTER = -4, //!< null pointer exception
ERROR_EX_ILLEGAL_STATE = -5, //!< illegal state exception
ERROR_EX_NETWORK_MAIN_THREAD = -6, //!< network main thread exception
ERROR_EX_UNSUPPORTED_OPERATION = -7, //!< unsupported operation exception
ERROR_EX_SERVICE_SPECIFIC = -8, //!< service specific exception
ERROR_EX_PARCELABLE = -9, //!< parcelable exception
ERROR_EX_ILLEGAL_ARGUMENT = -3, // illegal argument exception
ERROR_EX_NULL_POINTER = -4, // null pointer exception
ERROR_EX_ILLEGAL_STATE = -5, // illegal state exception
ERROR_EX_NETWORK_MAIN_THREAD = -6, // network main thread exception
ERROR_EX_UNSUPPORTED_OPERATION = -7, // unsupported operation exception
ERROR_EX_SERVICE_SPECIFIC = -8, // service specific exception
ERROR_EX_PARCELABLE = -9, // parcelable exception
// no error
NO_ERROR = 0, //!< no error
NO_ERROR = 0, // no error
// system service error
ERROR_NULL_POINTER, //!< null pointer
ERROR_BAD_PARAMETERS, //!< bad parameters
ERROR_SERVICE_START_FAILED, //!< failed to start service
ERROR_USER_NOT_STARTED, //!< user is not started
ERROR_USER_ALREADY_STARTED, //!< user has already started
ERROR_USER_NOT_UNLOCKED, //!< user is not unlocked
ERROR_USER_ALREADY_UNLOCKED, //!< user has already unlocked
ERROR_USER_NOT_LOCKED, //!< user is not locked
ERROR_NULL_POINTER, // null pointer
ERROR_BAD_PARAMETERS, // bad parameters
ERROR_SERVICE_START_FAILED, // failed to start service
ERROR_USER_NOT_STARTED, // user is not started
ERROR_USER_ALREADY_STARTED, // user has already started
ERROR_USER_NOT_UNLOCKED, // user is not unlocked
ERROR_USER_ALREADY_UNLOCKED, // user has already unlocked
ERROR_USER_NOT_LOCKED, // user is not locked
ERROR_IME_NOT_AVAILABLE, //!< input method engine is not available
ERROR_SECURITY_IME_NOT_AVAILABLE, //!< security input method engine is not available
ERROR_TOKEN_CREATE_FAILED, //!< failed to create window token
ERROR_TOKEN_DESTROY_FAILED, //!< failed to destroy window token
ERROR_IME_BIND_FAILED, //!< failed to bind IME service
ERROR_IME_UNBIND_FAILED, //!< failed to unbind IME service
ERROR_IME_START_FAILED, //!< failed to start IME service
ERROR_IME_STOP_FAILED, //!< failed to stop IME service
ERROR_KBD_SHOW_FAILED, //!< failed to show keyboard
ERROR_KBD_HIDE_FAILED, //!< failed to hide keyboard
ERROR_IME_NOT_STARTED, //!< input method service is not started
ERROR_KBD_IS_OCCUPIED, //!< keyboard is showing by other client
ERROR_KBD_IS_NOT_SHOWING, //!< keyboard is not showing
ERROR_IME_ALREADY_STARTED, //!< input method service has already started
ERROR_NOT_IME_PACKAGE, //!< not an IME package
ERROR_IME_PACKAGE_DUPLICATED, //!< duplicated IME package
ERROR_SETTING_SAME_VALUE, //!< same setting value
ERROR_NO_NEXT_IME, //!< no next ime is available
ERROR_CLIENTWINDOW_NOT_FOCUSED, //!< the input client window is not focused
ERROR_CLIENT_NOT_WINDOW, //!< the input client is not from a valid window
ERROR_IME_NOT_AVAILABLE, // input method engine is not available
ERROR_SECURITY_IME_NOT_AVAILABLE, // security input method engine is not available
ERROR_TOKEN_CREATE_FAILED, // failed to create window token
ERROR_TOKEN_DESTROY_FAILED, // failed to destroy window token
ERROR_IME_BIND_FAILED, // failed to bind IME service
ERROR_IME_UNBIND_FAILED, // failed to unbind IME service
ERROR_IME_START_FAILED, // failed to start IME service
ERROR_IME_STOP_FAILED, // failed to stop IME service
ERROR_KBD_SHOW_FAILED, // failed to show keyboard
ERROR_KBD_HIDE_FAILED, // failed to hide keyboard
ERROR_IME_NOT_STARTED, // input method service is not started
ERROR_KBD_IS_OCCUPIED, // keyboard is showing by other client
ERROR_KBD_IS_NOT_SHOWING, // keyboard is not showing
ERROR_IME_ALREADY_STARTED, // input method service has already started
ERROR_NOT_IME_PACKAGE, // not an IME package
ERROR_IME_PACKAGE_DUPLICATED, // duplicated IME package
ERROR_SETTING_SAME_VALUE, // same setting value
ERROR_NO_NEXT_IME, // no next ime is available
ERROR_CLIENTWINDOW_NOT_FOCUSED, // the input client window is not focused
ERROR_CLIENT_NOT_WINDOW, // the input client is not from a valid window
// error from ime
ERROR_REMOTE_IME_DIED, //!< remote input method service died abnormally
ERROR_RESTART_IME_FAILED, //!< failed to restart input method service
ERROR_REMOTE_IME_DIED, // remote input method service died abnormally
ERROR_RESTART_IME_FAILED, // failed to restart input method service
// error from client
ERROR_REMOTE_CLIENT_DIED, //!< remote client died abnormally
ERROR_CLIENT_DUPLICATED, //!< duplicated client
ERROR_CLIENT_NOT_FOUND, //!< client is not found
ERROR_REMOTE_CLIENT_DIED, // remote client died abnormally
ERROR_CLIENT_DUPLICATED, // duplicated client
ERROR_CLIENT_NOT_FOUND, // client is not found
};
const char* ToString(int errorCode);
};
@@ -166,7 +165,6 @@ static constexpr HiviewDFX::HiLogLabel g_SMALL_SERVICES_LABEL = {
"line: %d, function: %s," fmt, __LINE__, __FUNCTION__, ##__VA_ARGS__)
#define IMSA_HILOGW(fmt, ...) (void)OHOS::HiviewDFX::HiLog::Warn(OHOS::MiscServices::g_SMALL_SERVICES_LABEL, \
"line: %d, function: %s," fmt, __LINE__, __FUNCTION__, ##__VA_ARGS__)
}
}
#endif // FM_IMMS_PROJECT_GLOBAL_H
+1 -2
View File
@@ -35,7 +35,7 @@ namespace OHOS {
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.miscservices.inputmethod.InputControlChannel");
virtual void onAgentCreated(sptr<IInputMethodAgent>& agent, InputChannel* channel) = 0;
virtual void onAgentCreated(sptr<IInputMethodAgent>& agent, InputChannel *channel) = 0;
virtual void hideKeyboardSelf(int flags) = 0;
virtual bool advanceToNext(bool isCurrentIme) = 0;
virtual void setDisplayMode(int mode) = 0;
@@ -43,5 +43,4 @@ namespace OHOS {
};
}
}
#endif // FM_IMMS_PROJECT_IINPUTCONTROLCHANNEL_H
-1
View File
@@ -34,5 +34,4 @@ namespace OHOS {
};
}
}
#endif // FM_IMMS_PROJECT_IINPUTMETHODAGENT_H
@@ -30,38 +30,37 @@
namespace OHOS {
namespace MiscServices {
class IInputMethodSystemAbility : public IRemoteBroker {
public:
enum {
PREPARE_INPUT = 0,
RELEASE_INPUT,
START_INPUT,
STOP_INPUT,
SET_INPUT_METHOD_CORE,
GET_DISPLAY_MODE,
GET_KEYBOARD_WINDOW_HEIGHT,
GET_CURRENT_KEYBOARD_TYPE,
LIST_INPUT_METHOD_ENABLED,
LIST_INPUT_METHOD,
LIST_KEYBOARD_TYPE,
class IInputMethodSystemAbility : public IRemoteBroker {
public:
enum {
PREPARE_INPUT = 0,
RELEASE_INPUT,
START_INPUT,
STOP_INPUT,
SET_INPUT_METHOD_CORE,
GET_DISPLAY_MODE,
GET_KEYBOARD_WINDOW_HEIGHT,
GET_CURRENT_KEYBOARD_TYPE,
LIST_INPUT_METHOD_ENABLED,
LIST_INPUT_METHOD,
LIST_KEYBOARD_TYPE,
};
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.miscservices.inputmethod.IInputMethodSystemAbility");
virtual void prepareInput(MessageParcel& data) = 0;
virtual void releaseInput(MessageParcel& data) = 0;
virtual void startInput(MessageParcel& data) = 0;
virtual void stopInput(MessageParcel& data) = 0;
virtual int32_t setInputMethodCore(sptr<IInputMethodCore> &core)=0;
virtual int32_t getDisplayMode(int32_t *retMode) = 0;
virtual int32_t getKeyboardWindowHeight(int32_t retHeight) = 0;
virtual int32_t getCurrentKeyboardType(KeyboardType *retType) = 0;
virtual int32_t listInputMethodEnabled(std::vector<InputMethodProperty*> *properties) = 0;
virtual int32_t listInputMethod(std::vector<InputMethodProperty*> *properties) = 0;
virtual int32_t listKeyboardType(const std::u16string& imeId, std::vector<KeyboardType*> *types) = 0;
};
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.miscservices.inputmethod.IInputMethodSystemAbility");
virtual void prepareInput(MessageParcel& data) = 0;
virtual void releaseInput(MessageParcel& data) = 0;
virtual void startInput(MessageParcel& data) = 0;
virtual void stopInput(MessageParcel& data) = 0;
virtual int32_t setInputMethodCore(sptr<IInputMethodCore> &core)=0;
virtual int32_t getDisplayMode(int32_t *retMode) = 0;
virtual int32_t getKeyboardWindowHeight(int32_t *retHeight) = 0;
virtual int32_t getCurrentKeyboardType(KeyboardType* retType) = 0;
virtual int32_t listInputMethodEnabled(std::vector<InputMethodProperty*> *properties) = 0;
virtual int32_t listInputMethod(std::vector<InputMethodProperty*> *properties) = 0;
virtual int32_t listKeyboardType(const std::u16string& imeId, std::vector<KeyboardType*> *types) = 0;
};
}
}
#endif // FM_IMMS_PROJECT_IINPUTMETHODSYSTEMABILITY_H
+1 -1
View File
@@ -51,7 +51,7 @@ namespace OHOS {
virtual int32_t unbindInputMethodService(int userId, const std::u16string& packageName) = 0;
virtual sptr<IRemoteObject> createWindowToken(int userId, int displayId, const std::u16string& packageName) = 0;
virtual int32_t destroyWindowToken(int userId, const std::u16string& packageName) = 0;
virtual int32_t listInputMethod(int userId, std::vector<InputMethodProperty*> *inputMethodProperties) = 0;
virtual int32_t listInputMethod(int userId, std::vector<InputMethodProperty*> *properties) = 0;
virtual int32_t getInputMethodProperty(int userId, const std::u16string& packageName,
InputMethodProperty *inputMethodProperty) = 0;
virtual int32_t getInputMethodSetting(int userId, InputMethodSetting *inputMethodSetting) = 0;
+17 -17
View File
@@ -19,23 +19,23 @@
namespace OHOS {
namespace MiscServices {
class InputAttribute : public Parcelable {
public:
InputAttribute();
InputAttribute(const InputAttribute& attribute);
InputAttribute& operator=(const InputAttribute& attribute);
~InputAttribute();
virtual bool Marshalling(Parcel &parcel) const override;
static InputAttribute *Unmarshalling(Parcel &parcel);
void SetInputPattern(int32_t pattern);
bool GetSecurityFlag();
static const int32_t PATTERN_TEXT = 0x00000001;
static const int32_t PATTERN_PASSWORD = 0x00000007;
private:
int32_t inputPattern;
int32_t enterKeyType;
int32_t inputOption;
};
class InputAttribute : public Parcelable {
public:
InputAttribute();
InputAttribute(const InputAttribute& attribute);
InputAttribute& operator=(const InputAttribute& attribute);
~InputAttribute();
virtual bool Marshalling(Parcel &parcel) const override;
static InputAttribute *Unmarshalling(Parcel &parcel);
void SetInputPattern(int32_t pattern);
bool GetSecurityFlag();
static const int32_t PATTERN_TEXT = 0x00000001;
static const int32_t PATTERN_PASSWORD = 0x00000007;
private:
int32_t inputPattern;
int32_t enterKeyType;
int32_t inputOption;
};
}
}
+2 -2
View File
@@ -22,7 +22,7 @@
namespace OHOS {
namespace MiscServices {
class InputChannel : public Parcelable{
class InputChannel : public Parcelable {
public:
InputChannel();
~InputChannel();
@@ -33,7 +33,7 @@ namespace MiscServices {
MessageParcel inputChannelParcel;
InputChannel(const InputChannel& channel);
InputChannel& operator=(const InputChannel& channel);
};
};
}
}
#endif // INPUTMETHODSYSTEMSERVICE_INPUTCHANNEL_H
@@ -33,7 +33,7 @@ namespace MiscServices {
InputControlChannelProxy(const sptr<IRemoteObject> &impl);
~InputControlChannelProxy();
virtual void onAgentCreated(sptr<IInputMethodAgent>& agent, InputChannel* channel) override;
virtual void onAgentCreated(sptr<IInputMethodAgent>& agent, InputChannel *channel) override;
virtual void hideKeyboardSelf(int flags) override;
virtual bool advanceToNext(bool isCurrentIme) override;
virtual void setDisplayMode(int mode) override;
@@ -41,6 +41,4 @@ namespace MiscServices {
};
}
}
#endif // FM_IMMS_PROJECT_INPUTCONTROLCHANNELPROXY_H
#endif // FM_IMMS_PROJECT_INPUTCONTROLCHANNELPROXY_H
@@ -35,7 +35,7 @@ namespace OHOS {
MessageParcel &data,
MessageParcel &reply,
MessageOption &option) override;
virtual void onAgentCreated(sptr<IInputMethodAgent>& agent, InputChannel* channel) override;
virtual void onAgentCreated(sptr<IInputMethodAgent>& agent, InputChannel *channel) override;
virtual void hideKeyboardSelf(int flags) override;
virtual bool advanceToNext(bool isCurrentIme) override;
virtual void setDisplayMode(int mode) override;
@@ -47,13 +47,14 @@ namespace OHOS {
private:
int userId_;
sptr<IInputMethodAgent> agent = nullptr;
InputChannel* channel = nullptr;
InputChannel *channel = nullptr;
std::mutex mtx;
std::condition_variable cv;
bool agentReadyFlag = false;
bool keyboardReadyFlag = false;
};
const int32_t sleepTime = 300;
};
}
}
#endif // FM_IMMS_PROJECT_INPUTCONTROLCHANNEL_SK_H
@@ -32,13 +32,13 @@ namespace OHOS {
InputMethodAbilityConnectionStub(const int index);
~InputMethodAbilityConnectionStub();
void OnAbilityConnectDone(const AppExecFwk::ElementName &element, const sptr<IRemoteObject> &remoteObject, int resultCode) override;
void OnAbilityConnectDone(const AppExecFwk::ElementName &element,
const sptr<IRemoteObject> &remoteObject, int resultCode) override;
void OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode) override;
void SetHandler(MessageHandler* handler);
void SetHandler(MessageHandler *handler);
private:
MessageHandler* messageHandler;
MessageHandler *messageHandler;
int mIndex;
};
}
+16 -16
View File
@@ -22,23 +22,23 @@
namespace OHOS {
namespace MiscServices {
class InputMethodProperty : public Parcelable {
public:
std::u16string mImeId;
std::u16string mPackageName;
std::u16string mAbilityName;
std::u16string mConfigurationPage;
bool isSystemIme;
int32_t mDefaultImeId;
std::vector<KeyboardType*> mTypes;
class InputMethodProperty : public Parcelable {
public:
std::u16string mImeId;
std::u16string mPackageName;
std::u16string mAbilityName;
std::u16string mConfigurationPage;
bool isSystemIme;
int32_t mDefaultImeId;
std::vector<KeyboardType*> mTypes;
InputMethodProperty();
~InputMethodProperty();
InputMethodProperty(const InputMethodProperty& property);
InputMethodProperty& operator=(const InputMethodProperty& property);
virtual bool Marshalling(Parcel &parcel) const override;
static InputMethodProperty *Unmarshalling(Parcel &parcel);
};
InputMethodProperty();
~InputMethodProperty();
InputMethodProperty(const InputMethodProperty& property);
InputMethodProperty& operator=(const InputMethodProperty& property);
virtual bool Marshalling(Parcel &parcel) const override;
static InputMethodProperty *Unmarshalling(Parcel &parcel);
};
}
}
#endif // FM_IMMS_PROJECT_INPUTMETHODPROPERTY_H
+5 -7
View File
@@ -26,13 +26,11 @@ namespace MiscServices {
class InputMethodSetting : public Parcelable {
public:
const static std::u16string CURRENT_INPUT_METHOD_TAG; //!< the item name of 'default IME' in the system setting
const static std::u16string ENABLED_INPUT_METHODS_TAG; //!< the item name of 'enabled IME list' in the system setting
const static std::u16string CURRENT_KEYBOARD_TYPE_TAG; //!< the item name of 'default keyboard type' in the system setting
const static std::u16string CURRENT_SYS_KEYBOARD_TYPE_TAG;
//!< the item name of 'default keyboard type for security IME in the system setting
const static std::u16string SYSTEM_LOCALE_TAG; //!< the item name of locale list supported in the system
const static std::u16string CURRENT_INPUT_METHOD_TAG; // default IME
const static std::u16string ENABLED_INPUT_METHODS_TAG; // enabled IME list
const static std::u16string CURRENT_KEYBOARD_TYPE_TAG; // default keyboard type
const static std::u16string CURRENT_SYS_KEYBOARD_TYPE_TAG; // default keyboard type for security IME
const static std::u16string SYSTEM_LOCALE_TAG; // locale list supported in the system
InputMethodSetting();
+18 -17
View File
@@ -43,10 +43,11 @@ namespace MiscServices {
int32_t GetUserState(int32_t userId);
int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
MessageOption &option) 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 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;
@@ -67,20 +68,20 @@ namespace MiscServices {
std::map<int32_t, MessageHandler*> msgHandlers;
void WorkThread();
PerUserSetting* GetUserSetting(int32_t userId);
PerUserSession* GetUserSession(int32_t userId);
int32_t OnUserStarted(const Message* msg);
int32_t OnUserStopped(const Message* msg);
int32_t OnUserUnlocked(const Message* msg);
int32_t OnUserLocked(const Message* msg);
int32_t OnPrepareInput(Message* msg);
int32_t OnHandleMessage(Message* msg);
int32_t OnRemotePeerDied(const Message* msg);
int32_t OnSettingChanged(const Message* msg);
int32_t OnPackageRemoved(const Message* msg);
int32_t OnPackageAdded(const Message* msg);
int32_t OnDisableIms(const Message* msg);
int32_t OnAdvanceToNext(const Message* msg);
PerUserSetting *GetUserSetting(int32_t userId);
PerUserSession *GetUserSession(int32_t userId);
int32_t OnUserStarted(const Message *msg);
int32_t OnUserStopped(const Message *msg);
int32_t OnUserUnlocked(const Message *msg);
int32_t OnUserLocked(const Message *msg);
int32_t OnPrepareInput(Message *msg);
int32_t OnHandleMessage(Message *msg);
int32_t OnRemotePeerDied(const Message *msg);
int32_t OnSettingChanged(const Message *msg);
int32_t OnPackageRemoved(const Message *msg);
int32_t OnPackageAdded(const Message *msg);
int32_t OnDisableIms(const Message *msg);
int32_t OnAdvanceToNext(const Message *msg);
ServiceRunningState state_;
sptr<InputMethodAbility> inputMethodAbility_;
@@ -24,18 +24,18 @@
namespace OHOS {
namespace MiscServices {
class InputMethodSystemAbilityStub : public IRemoteStub<IInputMethodSystemAbility> {
public:
int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
class InputMethodSystemAbilityStub : public IRemoteStub<IInputMethodSystemAbility> {
public:
int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) 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;
void setInputMethodCoreFromHap(MessageParcel& data);
protected:
int32_t getUserId(int32_t uid);
};
virtual void prepareInput(MessageParcel& data) override;
virtual void releaseInput(MessageParcel& data) override;
virtual void startInput(MessageParcel& data) override;
virtual void stopInput(MessageParcel& data) override;
void setInputMethodCoreFromHap(MessageParcel& data);
protected:
int32_t getUserId(int32_t uid);
};
}
}
+34 -34
View File
@@ -22,42 +22,42 @@
namespace OHOS {
namespace MiscServices {
class KeyboardType : public Parcelable {
public:
KeyboardType();
KeyboardType(const KeyboardType& type);
~KeyboardType();
KeyboardType& operator=(const KeyboardType& type);
virtual bool Marshalling(Parcel &parcel) const override;
static KeyboardType *Unmarshalling(Parcel &parcel);
void setId(int32_t typeId);
void setLabelId(int32_t labelId);
void setIconId(int32_t iconId);
void setAsciiCapability(bool isAsciiCapable);
void setLanguage(std::u16string language);
void setInputSource(std::u16string inputSource);
void setCustomizedValue(std::u16string keyBoardTypeCustomizedValue);
int32_t getId() const;
int32_t getLabelId() const;
int32_t getIconId() const;
int32_t getHashCode() const;
std::u16string getLanguage() const;
std::u16string getInputSource() const;
std::u16string getCustomizedValue() const;
bool supportsAscii();
class KeyboardType : public Parcelable {
public:
KeyboardType();
KeyboardType(const KeyboardType& type);
~KeyboardType();
KeyboardType& operator=(const KeyboardType& type);
virtual bool Marshalling(Parcel &parcel) const override;
static KeyboardType *Unmarshalling(Parcel &parcel);
void setId(int32_t typeId);
void setLabelId(int32_t labelId);
void setIconId(int32_t iconId);
void setAsciiCapability(bool isAsciiCapable);
void setLanguage(std::u16string language);
void setInputSource(std::u16string inputSource);
void setCustomizedValue(std::u16string customizedValue);
int32_t getId() const;
int32_t getLabelId() const;
int32_t getIconId() const;
int32_t getHashCode() const;
std::u16string getLanguage() const;
std::u16string getInputSource() const;
std::u16string getCustomizedValue() const;
bool supportsAscii();
private:
int32_t mId;
int32_t mHashCode;
int32_t mLabelId;
int32_t mIconId;
bool mIsAsciiCapable;
std::u16string mLanguage;
std::u16string mInputSource;
std::u16string mCustomizedValue;
private:
int32_t mId;
int32_t mHashCode;
int32_t mLabelId;
int32_t mIconId;
bool mIsAsciiCapable;
std::u16string mLanguage;
std::u16string mInputSource;
std::u16string mCustomizedValue;
const int32_t ID_NONE = 0;
};
const int32_t ID_NONE = 0;
};
}
}
#endif // FM_IMMS_PROJECT_KEYBOARDTYPE_H
+12 -12
View File
@@ -21,18 +21,18 @@
#include "message_parcel.h"
namespace OHOS {
namespace MiscServices {
class Message {
public:
int32_t msgId_; //!< message id
MessageParcel *msgContent_ = nullptr; //!< message content
Message(int32_t msgId, MessageParcel* msgContent);
explicit Message(const Message& msg);
Message& operator= (const Message& msg);
~Message();
private:
Message(const Message&&);
Message& operator= (const Message&&);
};
class Message {
public:
int32_t msgId_; // message id
MessageParcel *msgContent_ = nullptr; // message content
Message(int32_t msgId, MessageParcel *msgContent);
explicit Message(const Message& msg);
Message& operator= (const Message& msg);
~Message();
private:
Message(const Message&&);
Message& operator= (const Message&&);
};
}
}
+42 -43
View File
@@ -29,34 +29,34 @@ namespace MiscServices {
namespace MessageID {
enum {
// for system broadcast
MSG_ID_SYSTEM_START = 0, //!< system started
MSG_ID_SYSTEM_STOP, //!< system stopped
MSG_ID_USER_START, //!< a user started
MSG_ID_USER_STOP, //!< a user stopped
MSG_ID_USER_UNLOCK, //!< a user unlocked
MSG_ID_USER_LOCK, //!< a user locked
MSG_ID_PACKAGE_ADDED, //!< a package is installed
MSG_ID_PACKAGE_REMOVED, //!< a package is removed
MSG_ID_SETTING_CHANGED, //!< input method setting is changed
MSG_ID_SYSTEM_START = 0, // system started
MSG_ID_SYSTEM_STOP, // system stopped
MSG_ID_USER_START, // a user started
MSG_ID_USER_STOP, // a user stopped
MSG_ID_USER_UNLOCK, // a user unlocked
MSG_ID_USER_LOCK, // a user locked
MSG_ID_PACKAGE_ADDED, // a package is installed
MSG_ID_PACKAGE_REMOVED, // a package is removed
MSG_ID_SETTING_CHANGED, // input method setting is changed
// the request from client
MSG_ID_PREPARE_INPUT, //!< prepare input
MSG_ID_START_INPUT, //!< start input
MSG_ID_STOP_INPUT, //!< stop input
MSG_ID_RELEASE_INPUT, //!< release input
MSG_ID_PREPARE_INPUT, // prepare input
MSG_ID_START_INPUT, // start input
MSG_ID_STOP_INPUT, // stop input
MSG_ID_RELEASE_INPUT, // release input
MSG_ID_SET_INPUT_METHOD_CORE,
// the request to handle the condition that the remote object died
MSG_ID_CLIENT_DIED, //!< input client died
MSG_ID_IMS_DIED, //!< input method service died
MSG_ID_DISABLE_IMS, //!< disable input method service
MSG_ID_RESTART_IMS, //!< restart input method service
MSG_ID_HIDE_KEYBOARD_SELF, //!< hide the current keyboard
MSG_ID_ADVANCE_TO_NEXT, //!< switch to next
MSG_ID_SET_DISPLAY_MODE, //!< set display mode
MSG_ID_CLIENT_DIED, // input client died
MSG_ID_IMS_DIED, // input method service died
MSG_ID_DISABLE_IMS, // disable input method service
MSG_ID_RESTART_IMS, // restart input method service
MSG_ID_HIDE_KEYBOARD_SELF, // hide the current keyboard
MSG_ID_ADVANCE_TO_NEXT, // switch to next
MSG_ID_SET_DISPLAY_MODE, // set display mode
MSG_ID_SHELL_COMMAND, //!< shell command
MSG_ID_EXIT_SERVICE, //!< exit service
MSG_ID_SHELL_COMMAND, // shell command
MSG_ID_EXIT_SERVICE, // exit service
//the request from IMSA to IMC
MSG_ID_INSERT_CHAR,
@@ -65,36 +65,35 @@ namespace MessageID {
MSG_ID_ON_INPUT_READY,
// the request from IMSA to IMA
MSG_ID_SHOW_KEYBOARD, //
MSG_ID_INITIALIZE_INPUT, //
MSG_ID_HIDE_KEYBOARD, //
MSG_ID_SHOW_KEYBOARD,
MSG_ID_INITIALIZE_INPUT,
MSG_ID_HIDE_KEYBOARD,
MSG_ID_SET_KEYBOARD_TYPE,
MSG_ID_GET_KEYBOARD_WINDOW_HEIGHT,
// the request from IMC to IMA
MSG_ID_DISPATCH_KEY,//!< dispatch key from PhysicalKbd
MSG_ID_DISPATCH_KEY, // dispatch key from PhysicalKbd
};
}
class MessageHandler {
public:
MessageHandler();
~MessageHandler();
void SendMessage(Message* msg);
Message* GetMessage();
static MessageHandler* Instance();
public:
MessageHandler();
~MessageHandler();
void SendMessage(Message *msg);
Message *GetMessage();
static MessageHandler *Instance();
private:
std::mutex mMutex; //!< a mutex to guard message queue
std::condition_variable mCV; //!< condition variable to work with mMutex
std::queue<Message*> mQueue ;//!< Message queue, guarded by mMutex;
private:
std::mutex mMutex; // a mutex to guard message queue
std::condition_variable mCV; // condition variable to work with mMutex
std::queue<Message*> mQueue ; // Message queue, guarded by mMutex;
MessageHandler(const MessageHandler&);
MessageHandler& operator= (const MessageHandler&);
MessageHandler(const MessageHandler&&);
MessageHandler& operator= (const MessageHandler&&);
};
MessageHandler(const MessageHandler&);
MessageHandler& operator= (const MessageHandler&);
MessageHandler(const MessageHandler&&);
MessageHandler& operator= (const MessageHandler&&);
};
}
}
#endif // FM_IMMS_PROJECT_MESSAGEHANDLER_H
+47 -47
View File
@@ -47,9 +47,9 @@ namespace MiscServices {
RemoteObjectDeathRecipient(int userId, int msgId);
~RemoteObjectDeathRecipient();
void OnRemoteDied(const wptr<IRemoteObject>& who) override;
private :
int userId_; //!< the id of the user to whom the object is linking
int msgId_; //!< the message id can be MessageID::MSG_ID_CLIENT_DIED and MessageID::MSG_ID_IMS_DIED
private:
int userId_; // the id of the user to whom the object is linking
int msgId_; // the message id can be MessageID::MSG_ID_CLIENT_DIED and MessageID::MSG_ID_IMS_DIED
};
/*! \class ClientInfo
@@ -57,13 +57,13 @@ namespace MiscServices {
*/
class ClientInfo {
public:
int pid; //!< the process id of the process in which the input client is running
int uid; //!< the uid of the process in which the input client is running
int userId; //!< the user if of the user under which the input client is running
int displayId; //!< the display id on which the input client is showing
sptr<IInputClient> client; //!< the remote object handler for the service to callback to the input client
sptr<IInputDataChannel> channel; //!< the remote object handler for input method service callback to input client
InputAttribute attribute; //!< the input attribute of the input client
int pid; // the process id of the process in which the input client is running
int uid; // the uid of the process in which the input client is running
int userId; // the user if of the user under which the input client is running
int displayId; // the display id on which the input client is showing
sptr<IInputClient> client; // the remote object handler for the service to callback to the input client
sptr<IInputDataChannel> channel; // the remote object handler for IMSA callback to input client
InputAttribute attribute; // the input attribute of the input client
ClientInfo(int pid, int uid, int userId, int displayId, const sptr<IInputClient>& client,
const sptr<IInputDataChannel>& channel, const InputAttribute& attribute)
@@ -91,24 +91,24 @@ namespace MiscServices {
*/
class PerUserSession {
enum {
DEFAULT_IME = 0, //!< index for default input method service
SECURITY_IME = 1, //!< index for security input method service
MAX_IME = 2, //!< the maximum count of ims started for a user
DEFAULT_IME = 0, // index for default input method service
SECURITY_IME = 1, // index for security input method service
MAX_IME = 2, // the maximum count of ims started for a user
};
public:
explicit PerUserSession(int userId);
~PerUserSession();
void SetCurrentIme(InputMethodProperty* ime);
void SetSecurityIme(InputMethodProperty* ime);
void SetInputMethodSetting(InputMethodSetting* setting);
void ResetIme(InputMethodProperty* defaultIme, InputMethodProperty* securityIme);
void SetCurrentIme(InputMethodProperty *ime);
void SetSecurityIme(InputMethodProperty *ime);
void SetInputMethodSetting(InputMethodSetting *setting);
void ResetIme(InputMethodProperty *defaultIme, InputMethodProperty *securityIme);
void OnPackageRemoved(const std::u16string& packageName);
int GetDisplayMode();
int GetKeyboardWindowHeight(int *retHeight);
KeyboardType* GetCurrentKeyboardType();
int GetKeyboardWindowHeight(int retHeight);
KeyboardType *GetCurrentKeyboardType();
int OnSettingChanged(const std::u16string& key, const std::u16string& value);
void Dump(int fd);
@@ -117,33 +117,33 @@ namespace MiscServices {
void SetInputMethodAbility(sptr<InputMethodAbility> &inputMethodAbility);
static void BindInputAbility();
private:
int userId_; //!< the id of the user to whom the object is linking
int userState; //!< the state of the user to whom the object is linking
int displayId; //!< the id of the display screen on which the user is
int userId_; // the id of the user to whom the object is linking
int userState; // the state of the user to whom the object is linking
int displayId; // the id of the display screen on which the user is
int currentIndex;
std::map<sptr<IRemoteObject>, ClientInfo*> mapClients; //!< a map to manage the input clients connected to the service
std::map<sptr<IRemoteObject>, ClientInfo*> mapClients;
InputMethodProperty* currentIme[MAX_IME]; //!< 0 - the default ime. 1 - security ime
InputMethodProperty *currentIme[MAX_IME]; // 0 - the default ime. 1 - security ime
InputControlChannelStub* localControlChannel[MAX_IME]; //!< inputControlChannel object used by the local process
sptr<IInputControlChannel> inputControlChannel[MAX_IME]; //!< channels between the service and input method service
sptr<IInputMethodCore> imsCore[MAX_IME]; //!< the remote handlers of input method service
sptr<IRemoteObject> inputMethodToken[MAX_IME]; //!< the window token of keyboard
int currentKbdIndex[MAX_IME]; //!< current keyboard index
int lastImeIndex; //!< The last ime which showed keyboard
InputMethodSetting* inputMethodSetting; //!< The pointer referred to the object in PerUserSetting
int currentDisplayMode; //!< the display mode of the current keyboard
InputControlChannelStub *localControlChannel[MAX_IME];
sptr<IInputControlChannel> inputControlChannel[MAX_IME];
sptr<IInputMethodCore> imsCore[MAX_IME]; // the remote handlers of input method service
sptr<IRemoteObject> inputMethodToken[MAX_IME]; // the window token of keyboard
int currentKbdIndex[MAX_IME]; // current keyboard index
int lastImeIndex; // The last ime which showed keyboard
InputMethodSetting *inputMethodSetting; // The pointer referred to the object in PerUserSetting
int currentDisplayMode; // the display mode of the current keyboard
sptr<IInputMethodAgent> imsAgent;
InputChannel* imsChannel; //!< the write channel created by input method service
sptr<IInputClient> currentClient; //!< the current input client
sptr<IInputClient> needReshowClient; //!< the input client for which keyboard need to re-show
InputChannel *imsChannel; // the write channel created by input method service
sptr<IInputClient> currentClient; // the current input client
sptr<IInputClient> needReshowClient; // the input client for which keyboard need to re-show
sptr<RemoteObjectDeathRecipient> clientDeathRecipient; //!< remote object death monitor for input client
sptr<RemoteObjectDeathRecipient> imsDeathRecipient; //!< remote object death monitor for input method service
MessageHandler* msgHandler = nullptr; //!< message handler working with Work Thread
std::thread workThreadHandler; //!< work thread handler
std::mutex mtx; //!< mutex to lock the operations among multi work threads
sptr<RemoteObjectDeathRecipient> clientDeathRecipient; // remote object death monitor for input client
sptr<RemoteObjectDeathRecipient> imsDeathRecipient;
MessageHandler *msgHandler = nullptr; // message handler working with Work Thread
std::thread workThreadHandler; // work thread handler
std::mutex mtx; // mutex to lock the operations among multi work threads
sptr<AAFwk::AbilityConnectionProxy> connCallback;
sptr<InputMethodAbility> inputMethodAbility_;
@@ -152,18 +152,18 @@ namespace MiscServices {
PerUserSession(const PerUserSession&&);
PerUserSession& operator= (const PerUserSession&&);
int IncreaseOrResetImeError(bool resetFlag, int imeIndex);
KeyboardType* GetKeyboardType(int imeIndex, int typeIndex);
KeyboardType *GetKeyboardType(int imeIndex, int typeIndex);
void ResetCurrentKeyboardType(int imeIndex);
int OnCurrentKeyboardTypeChanged(int index, const std::u16string& value);
void DumpClientInfo(int fd, const ClientInfo& clientInfo);
void DumpCurrentSession(int fd);
void CopyInputMethodService(int imeIndex);
ClientInfo* GetClientInfo(const sptr<IInputClient>& inputClient);
ClientInfo *GetClientInfo(const sptr<IInputClient>& inputClient);
void WorkThread();
void OnPrepareInput(Message* msg);
void OnReleaseInput(Message* msg);
void OnStartInput(Message* msg);
void OnStopInput(Message* msg);
void OnPrepareInput(Message *msg);
void OnReleaseInput(Message *msg);
void OnStartInput(Message *msg);
void OnStopInput(Message *msg);
void OnClientDied(const wptr<IRemoteObject>& who);
void OnImsDied(const wptr<IRemoteObject>& who);
void OnHideKeyboardSelf(int flags);
@@ -182,7 +182,7 @@ namespace MiscServices {
void SetDisplayId(int displayId);
int GetImeIndex(const sptr<IInputClient>& inputClient);
static sptr<AAFwk::IAbilityManager> GetAbilityManagerService();
void onSetInputMethodCore(Message* msg);
void onSetInputMethodCore(Message *msg);
};
}
}
+36 -36
View File
@@ -25,49 +25,49 @@
namespace OHOS {
namespace MiscServices {
class PerUserSetting {
public:
explicit PerUserSetting(int32_t userId);
class PerUserSetting {
public:
explicit PerUserSetting(int32_t userId);
~PerUserSetting();
~PerUserSetting();
void Initialize();
int32_t GetUserState();
InputMethodProperty* GetCurrentInputMethod();
InputMethodProperty* GetSecurityInputMethod();
InputMethodProperty* GetNextInputMethod();
InputMethodSetting* GetInputMethodSetting();
InputMethodProperty* GetInputMethodProperty(const std::u16string& imeId);
void Initialize();
int32_t GetUserState();
InputMethodProperty *GetCurrentInputMethod();
InputMethodProperty *GetSecurityInputMethod();
InputMethodProperty *GetNextInputMethod();
InputMethodSetting *GetInputMethodSetting();
InputMethodProperty *GetInputMethodProperty(const std::u16string& imeId);
int32_t OnPackageAdded(std::u16string& packageName, bool* isSecurityIme = nullptr);
int32_t OnPackageRemoved(std::u16string& packageName, bool* isSecurityIme = nullptr);
int32_t OnSettingChanged(const std::u16string& key, const std::u16string& value);
void OnAdvanceToNext();
void OnUserLocked();
void Dump(int32_t fd);
int32_t OnPackageAdded(std::u16string& packageName, bool isSecurityIme);
int32_t OnPackageRemoved(std::u16string& packageName, bool isSecurityIme);
int32_t OnSettingChanged(const std::u16string& key, const std::u16string& value);
void OnAdvanceToNext();
void OnUserLocked();
void Dump(int32_t fd);
int32_t ListInputMethodEnabled(std::vector<InputMethodProperty*> *properties);
int32_t ListInputMethod(std::vector<InputMethodProperty*> *properties);
int32_t ListKeyboardType(const std::u16string& imeId, std::vector<KeyboardType*> *types);
int32_t ListInputMethodEnabled(std::vector<InputMethodProperty*> *properties);
int32_t ListInputMethod(std::vector<InputMethodProperty*> *properties);
int32_t ListKeyboardType(const std::u16string& imeId, std::vector<KeyboardType*> *types);
static bool CheckIfSecurityIme(const InputMethodProperty& property);
static bool CheckIfSecurityIme(const InputMethodProperty& property);
private:
int32_t userId_; //!< the id of the user to whom the object is linking
int32_t userState; //!< the state of the user to whom the object is linking
std::vector<InputMethodProperty*> inputMethodProperties; //!< a vector to save all IME installed for this user
std::u16string currentImeId; //!< the id of the default input method engine.
InputMethodSetting inputMethodSetting; //!< the object to manage the setting data for this user
private:
int32_t userId_; // the id of the user to whom the object is linking
int32_t userState; // the state of the user to whom the object is linking
std::vector<InputMethodProperty*> inputMethodProperties; // a vector to save all IME installed for this user
std::u16string currentImeId; // the id of the default input method engine.
InputMethodSetting inputMethodSetting; // the object to manage the setting data for this user
PerUserSetting(const PerUserSetting&);
PerUserSetting& operator= (const PerUserSetting&);
PerUserSetting(const PerUserSetting&&);
PerUserSetting& operator= (const PerUserSetting&&);
void InitInputMethodSetting();
void ResetCurrentInputMethod();
std::u16string GetKeyboardTypeLanguage(const InputMethodProperty* property, int32_t hashCode);
std::u16string GetImeId(const std::u16string& packageName);
};
PerUserSetting(const PerUserSetting&);
PerUserSetting& operator= (const PerUserSetting&);
PerUserSetting(const PerUserSetting&&);
PerUserSetting& operator= (const PerUserSetting&&);
void InitInputMethodSetting();
void ResetCurrentInputMethod();
std::u16string GetKeyboardTypeLanguage(const InputMethodProperty *property, int32_t hashCode);
std::u16string GetImeId(const std::u16string& packageName);
};
}
}
#endif // FM_IMMS_PROJECT_PERUSERSETTING_H
+7 -7
View File
@@ -28,19 +28,19 @@
namespace OHOS {
namespace MiscServices {
class Platform {
public:
static Platform* Instance();
static Platform *Instance();
void SetPlatform(const sptr<IPlatformApi>& platformApi);
sptr<IInputMethodCore> BindInputMethodService(int userId, const std::u16string& packageName, const std::u16string& intention);
sptr<IInputMethodCore> BindInputMethodService(int userId, const std::u16string& packageName,
const std::u16string& intention);
int UnbindInputMethodService(int userId, const std::u16string& packageName);
sptr<IRemoteObject> CreateWindowToken(int userId, int displayId, const std::u16string& packageName);
int DestroyWindowToken(int userId, const std::u16string& packageName);
int ListInputMethod(int userId, std::vector<InputMethodProperty*>* inputMethodProperties);
int GetInputMethodProperty(int userId, const std::u16string& packageName, InputMethodProperty* inputMethodProperty);
int GetInputMethodSetting(int userId, InputMethodSetting* inputMethodSetting);
int ListInputMethod(int userId, std::vector<InputMethodProperty*> *properties);
int GetInputMethodProperty(int userId, const std::u16string& packageName,
InputMethodProperty *inputMethodProperty);
int GetInputMethodSetting(int userId, InputMethodSetting *inputMethodSetting);
int SetInputMethodSetting(int userId, const InputMethodSetting& inputMethodSetting);
bool CheckPhysicalKeyboard();
bool IsValidWindow(int uid, int pid, int displayId);
+2 -2
View File
@@ -24,13 +24,13 @@
namespace OHOS {
namespace MiscServices {
class PlatformCallbackStub : public IRemoteStub<IPlatformCallback> {
public:
PlatformCallbackStub();
~PlatformCallbackStub();
virtual int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
virtual int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
MessageOption &option) override;
virtual void notifyEvent(int eventId, int userId, const std::vector<std::u16string>& eventContent) override;
};
+9 -9
View File
@@ -25,15 +25,15 @@
namespace OHOS {
namespace MiscServices {
class Utils {
public:
static std::string to_utf8( std::u16string str16 ) {
return std::wstring_convert< std::codecvt_utf8_utf16<char16_t>, char16_t >{}.to_bytes(str16);
}
static std::u16string to_utf16( std::string str ) {
return std::wstring_convert< std::codecvt_utf8_utf16<char16_t>, char16_t >{}.from_bytes(str);
}
};
class Utils {
public:
static std::string to_utf8(std::u16string str16) {
return std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.to_bytes(str16);
}
static std::u16string to_utf16(std::string str) {
return std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>{}.from_bytes(str);
}
};
}
}