add switch input fuction

Signed-off-by: gaoxiang <gaoxiang75@huawei.com>
This commit is contained in:
gaoxiang
2022-07-05 11:26:50 +08:00
parent 2a937f009f
commit 385852d753
10 changed files with 172 additions and 7 deletions
+6 -5
View File
@@ -136,6 +136,7 @@ namespace ErrorCode {
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_PROPERTY_MARSHALL, // failed to marshall the ime property
// error from ime
ERROR_REMOTE_IME_DIED, // remote input method service died abnormally
ERROR_RESTART_IME_FAILED, // failed to restart input method service
@@ -154,15 +155,15 @@ static constexpr HiviewDFX::HiLogLabel g_SMALL_SERVICES_LABEL = {
};
#define IMSA_HILOGD(fmt, ...) (void)OHOS::HiviewDFX::HiLog::Debug(OHOS::MiscServices::g_SMALL_SERVICES_LABEL, \
"line: %d, function: %s," fmt, __LINE__, __FUNCTION__, ##__VA_ARGS__)
"line: %{public}d, function: %{public}s," fmt, __LINE__, __FUNCTION__, ##__VA_ARGS__)
#define IMSA_HILOGE(fmt, ...) (void)OHOS::HiviewDFX::HiLog::Error(OHOS::MiscServices::g_SMALL_SERVICES_LABEL, \
"line: %d, function: %s," fmt, __LINE__, __FUNCTION__, ##__VA_ARGS__)
"line: %{public}d, function: %{public}s," fmt, __LINE__, __FUNCTION__, ##__VA_ARGS__)
#define IMSA_HILOGF(fmt, ...) (void)OHOS::HiviewDFX::HiLog::Fatal(OHOS::MiscServices::g_SMALL_SERVICES_LABEL, \
"line: %d, function: %s," fmt, __LINE__FILE__, __FUNCTION__, ##__VA_ARGS__)
"line: %{public}d, function: %{public}s," fmt, __LINE__FILE__, __FUNCTION__, ##__VA_ARGS__)
#define IMSA_HILOGI(fmt, ...) (void)OHOS::HiviewDFX::HiLog::Info(OHOS::MiscServices::g_SMALL_SERVICES_LABEL, \
"line: %d, function: %s," fmt, __LINE__, __FUNCTION__, ##__VA_ARGS__)
"line: %{public}d, function: %{public}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__)
"line: %{public}d, function: %{public}s," fmt, __LINE__, __FUNCTION__, ##__VA_ARGS__)
}
}
#endif // SERVICES_INCLUDE_GLOBAL_H
@@ -47,6 +47,7 @@ namespace MiscServices {
LIST_KEYBOARD_TYPE,
SET_CORE_AND_AGENT,
DISPLAY_OPTIONAL_INPUT_METHOD,
SWITCH_INPUT_METHOD,
};
DECLARE_INTERFACE_DESCRIPTOR(u"ohos.miscservices.inputmethod.IInputMethodSystemAbility");
@@ -73,7 +73,7 @@ namespace MiscServices {
void WorkThread();
PerUserSetting *GetUserSetting(int32_t userId);
PerUserSession *GetUserSession(int32_t userId);
void StartInputService(std::string imeId);
bool StartInputService(std::string imeId);
void StopInputService(std::string imeId);
int32_t OnUserStarted(const Message *msg);
int32_t OnUserStopped(const Message *msg);
@@ -90,6 +90,7 @@ namespace MiscServices {
static sptr<AAFwk::IAbilityManager> GetAbilityManagerService();
OHOS::sptr<OHOS::AppExecFwk::IBundleMgr> GetBundleMgr();
void StartUserIdListener();
int32_t OnSwitchInputMethod(int32_t userId, InputMethodProperty *target);
ServiceRunningState state_;
void InitServiceHandler();
@@ -37,6 +37,7 @@ namespace MiscServices {
void HideCurrentInput(MessageParcel& data) override;
void displayOptionalInputMethod(MessageParcel& data) override;
virtual int32_t listInputMethodByUserId(int32_t userId, std::vector<InputMethodProperty*> *properties) = 0;
int32_t SwitchInputMethod(MessageParcel &data, MessageParcel &reply);
protected:
int32_t getUserId(int32_t uid);
+2
View File
@@ -25,7 +25,9 @@ namespace MiscServices {
public:
int32_t msgId_; // message id
MessageParcel *msgContent_ = nullptr; // message content
MessageParcel *msgReply_ = nullptr; // message reply
Message(int32_t msgId, MessageParcel *msgContent);
Message(int32_t msgId, MessageParcel *msgContent, MessageParcel *msgReply);
explicit Message(const Message& msg);
Message& operator =(const Message& msg);
~Message();
+1
View File
@@ -46,6 +46,7 @@ namespace MessageID {
MSG_ID_RELEASE_INPUT, // release input
MSG_ID_SET_CORE_AND_AGENT,
MSG_HIDE_CURRENT_INPUT,
MSG_ID_SWITCH_INPUT_METHOD, // switch input method
// the request to handle the condition that the remote object died
MSG_ID_CLIENT_DIED, // input client died