From 9ba3c5f6213daa0f2a6917ab4197fb958d18fdb9 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Wed, 1 Jun 2022 18:48:30 +0800 Subject: [PATCH 01/11] Signed-off-by: lovechinamo Changes to be committed: --- .../inputmethod_ability/src/input_method_core_proxy.cpp | 2 +- services/src/input_method_system_ability.cpp | 2 +- services/src/peruser_session.cpp | 2 +- services/src/peruser_setting.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp b/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp index 28e333f..1626863 100644 --- a/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp +++ b/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp @@ -287,7 +287,7 @@ namespace MiscServices { return code; } - int32_t InputMethodCoreProxy::getKeyboardWindowHeight(int32_t retHeight) + int32_t InputMethodCoreProxy::getKeyboardWindowHeight(int32_t &retHeight) { IMSA_HILOGI("InputMethodCoreProxy::getKeyboardWindowHeight"); auto remote = Remote(); diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index 20886f2..40f6e9a 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -208,7 +208,7 @@ namespace MiscServices { std::map::const_iterator it = msgHandlers.find(MAIN_USER_ID); if (it == msgHandlers.end()) { IMSA_HILOGE("InputMethodSystemAbility::StartInputService() need start handler"); - MessageHandler *handler = new MessageHandler(); + sptr handler = new MessageHandler(); if (session) { IMSA_HILOGE("InputMethodSystemAbility::OnPrepareInput session is not nullptr"); session->CreateWorkThread(*handler); diff --git a/services/src/peruser_session.cpp b/services/src/peruser_session.cpp index 14a2822..39ea66f 100644 --- a/services/src/peruser_session.cpp +++ b/services/src/peruser_session.cpp @@ -237,7 +237,7 @@ namespace MiscServices { { IMSA_HILOGI("PerUserSession::ResetIme"); std::unique_lock lock(mtx); - InputMethodProperty *ime[] = {defaultIme, securityIme}; + InputMethodProperty *ime[2] = {defaultIme, securityIme}; for (int i = 0; i < MIN_IME; i++) { if (currentIme[i] == ime[i] && ime[i]) { continue; diff --git a/services/src/peruser_setting.cpp b/services/src/peruser_setting.cpp index 902ce6f..2fc1d64 100644 --- a/services/src/peruser_setting.cpp +++ b/services/src/peruser_setting.cpp @@ -76,7 +76,7 @@ namespace MiscServices { * ErrorCode::ERROR_NOT_IME_PACKAGE The installed package is not an IME package. * ErrorCode::ERROR_IME_PACKAGE_DUPLICATED The installed package is duplicated. */ - int PerUserSetting::OnPackageAdded(std::u16string& packageName, bool isSecurityIme) + int PerUserSetting::OnPackageAdded(std::u16string& packageName, bool &isSecurityIme) { if (isSecurityIme) { isSecurityIme = false; @@ -126,7 +126,7 @@ namespace MiscServices { * and is removed from the input method management system * ErrorCode::ERROR_NOT_IME_PACKAGE The removed package is not an IME package. */ - int PerUserSetting::OnPackageRemoved(std::u16string& packageName, bool isSecurityIme) + int PerUserSetting::OnPackageRemoved(std::u16string& packageName, bool &isSecurityIme) { if (isSecurityIme) { isSecurityIme = false; From b1c42942e9b554a4c913ff1c22d51447d9db9b60 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Wed, 1 Jun 2022 18:52:27 +0800 Subject: [PATCH 02/11] Signed-off-by: lovechinamo Changes to be committed: --- services/src/input_method_system_ability.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index 40f6e9a..e24eb26 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -285,7 +285,7 @@ namespace MiscServices { \return ErrorCode::NO_ERROR no error \return ErrorCode::ERROR_USER_NOT_UNLOCKED user not unlocked */ - int32_t InputMethodSystemAbility::getDisplayMode(int32_t retMode) + int32_t InputMethodSystemAbility::getDisplayMode(int32_t &retMode) { int32_t uid = IPCSkeleton::GetCallingUid(); int32_t userId = getUserId(uid); From 7455557387b410819b8278d6db8a515d0f4db853 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Wed, 1 Jun 2022 19:07:58 +0800 Subject: [PATCH 03/11] Signed-off-by: lovechinamo Changes to be committed: --- .../inputmethod_ability/include/input_method_core_proxy.h | 2 +- services/include/input_method_system_ability.h | 2 +- services/include/peruser_setting.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frameworks/inputmethod_ability/include/input_method_core_proxy.h b/frameworks/inputmethod_ability/include/input_method_core_proxy.h index 7f1f09b..eec719f 100644 --- a/frameworks/inputmethod_ability/include/input_method_core_proxy.h +++ b/frameworks/inputmethod_ability/include/input_method_core_proxy.h @@ -43,7 +43,7 @@ namespace MiscServices { bool showKeyboard(const sptr& inputDataChannel) override; bool hideKeyboard(int32_t flags) override; int32_t setKeyboardType(const KeyboardType& type) override; - int32_t getKeyboardWindowHeight(int32_t retHeight) override; + int32_t getKeyboardWindowHeight(int32_t &retHeight) override; int32_t InitInputControlChannel(sptr &inputControlChannel) override; void SetClientState(bool state) override; void StopInputService(std::string imeId) override; diff --git a/services/include/input_method_system_ability.h b/services/include/input_method_system_ability.h index 9f434a8..1bf67a7 100644 --- a/services/include/input_method_system_ability.h +++ b/services/include/input_method_system_ability.h @@ -47,7 +47,7 @@ namespace MiscServices { int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - int32_t getDisplayMode(int32_t retMode) override; + int32_t getDisplayMode(int32_t &retMode) override; int32_t getKeyboardWindowHeight(int32_t retHeight) override; int32_t getCurrentKeyboardType(KeyboardType *retType) override; int32_t listInputMethodEnabled(std::vector *properties) override; diff --git a/services/include/peruser_setting.h b/services/include/peruser_setting.h index 50546ab..c69298c 100644 --- a/services/include/peruser_setting.h +++ b/services/include/peruser_setting.h @@ -39,8 +39,8 @@ namespace MiscServices { InputMethodSetting *GetInputMethodSetting(); InputMethodProperty *GetInputMethodProperty(const std::u16string& imeId); - int32_t OnPackageAdded(std::u16string& packageName, bool isSecurityIme); - int32_t OnPackageRemoved(std::u16string& packageName, bool isSecurityIme); + 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(); From 6ca93abdb24ba3b84f4e936643ea7e8286ca7f8c Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Wed, 1 Jun 2022 19:34:16 +0800 Subject: [PATCH 04/11] Signed-off-by: lovechinamo Changes to be committed: --- frameworks/inputmethod_ability/include/i_input_method_core.h | 2 +- .../inputmethod_ability/include/input_method_core_stub.h | 2 +- frameworks/inputmethod_ability/src/input_method_core_stub.cpp | 2 +- .../include/input_method_system_ability_proxy.h | 4 ++-- .../src/input_method_system_ability_proxy.cpp | 4 ++-- services/include/i_input_method_system_ability.h | 4 ++-- services/include/input_method_system_ability.h | 2 +- services/include/peruser_session.h | 2 +- services/src/input_method_system_ability.cpp | 2 +- services/src/peruser_session.cpp | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/frameworks/inputmethod_ability/include/i_input_method_core.h b/frameworks/inputmethod_ability/include/i_input_method_core.h index a9b2bc6..112aaac 100644 --- a/frameworks/inputmethod_ability/include/i_input_method_core.h +++ b/frameworks/inputmethod_ability/include/i_input_method_core.h @@ -56,7 +56,7 @@ namespace MiscServices { virtual bool showKeyboard(const sptr& inputDataChannel) = 0; virtual bool hideKeyboard(int32_t flags) = 0; virtual int32_t setKeyboardType(const KeyboardType& type) = 0; - virtual int32_t getKeyboardWindowHeight(int32_t retHeight) = 0; + virtual int32_t getKeyboardWindowHeight(int32_t &retHeight) = 0; virtual int32_t InitInputControlChannel(sptr &inputControlChannel) = 0; virtual void SetClientState(bool state) = 0; virtual void StopInputService(std::string imeId) = 0; diff --git a/frameworks/inputmethod_ability/include/input_method_core_stub.h b/frameworks/inputmethod_ability/include/input_method_core_stub.h index 5d10014..0e68056 100644 --- a/frameworks/inputmethod_ability/include/input_method_core_stub.h +++ b/frameworks/inputmethod_ability/include/input_method_core_stub.h @@ -52,7 +52,7 @@ namespace MiscServices { bool showKeyboard(const sptr& inputDataChannel) override; bool hideKeyboard(int32_t flags)override; int32_t setKeyboardType(const KeyboardType& type) override; - int32_t getKeyboardWindowHeight(int32_t retHeight) override; + int32_t getKeyboardWindowHeight(int32_t &retHeight) override; int32_t InitInputControlChannel(sptr &inputControlChannel) override; void SetClientState(bool state) override; void StopInputService(std::string imeId) override; diff --git a/frameworks/inputmethod_ability/src/input_method_core_stub.cpp b/frameworks/inputmethod_ability/src/input_method_core_stub.cpp index 8c0484d..e117853 100644 --- a/frameworks/inputmethod_ability/src/input_method_core_stub.cpp +++ b/frameworks/inputmethod_ability/src/input_method_core_stub.cpp @@ -287,7 +287,7 @@ namespace MiscServices { msgHandler_->SendMessage(msg); } - int32_t InputMethodCoreStub::getKeyboardWindowHeight(int32_t retHeight) + int32_t InputMethodCoreStub::getKeyboardWindowHeight(int32_t &retHeight) { IMSA_HILOGI("InputMethodCoreStub::getKeyboardWindowHeight"); if (!msgHandler_) { diff --git a/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h b/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h index 531cfc3..df30d91 100644 --- a/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h +++ b/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h @@ -50,8 +50,8 @@ namespace MiscServices { int32_t Stop(sptr &client); void displayOptionalInputMethod(MessageParcel& data) override; - int32_t getDisplayMode(int32_t retMode) override; - int32_t getKeyboardWindowHeight(int32_t retHeight) override; + int32_t getDisplayMode(int32_t &retMode) override; + int32_t getKeyboardWindowHeight(int32_t &retHeight) override; int32_t getCurrentKeyboardType(KeyboardType *retType) override; int32_t listInputMethodEnabled(std::vector *properties) override; int32_t listInputMethod(std::vector *properties) override; diff --git a/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp b/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp index 540861f..c639b6a 100644 --- a/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp +++ b/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp @@ -255,7 +255,7 @@ namespace MiscServices { return NO_ERROR; } - int32_t InputMethodSystemAbilityProxy::getDisplayMode(int32_t retMode) + int32_t InputMethodSystemAbilityProxy::getDisplayMode(int32_t &retMode) { MessageParcel data, reply; MessageOption option; @@ -280,7 +280,7 @@ namespace MiscServices { return NO_ERROR; } - int32_t InputMethodSystemAbilityProxy::getKeyboardWindowHeight(int32_t retHeight) + int32_t InputMethodSystemAbilityProxy::getKeyboardWindowHeight(int32_t &retHeight) { MessageParcel data, reply; MessageOption option; diff --git a/services/include/i_input_method_system_ability.h b/services/include/i_input_method_system_ability.h index 8319cd3..53ea3ef 100644 --- a/services/include/i_input_method_system_ability.h +++ b/services/include/i_input_method_system_ability.h @@ -59,8 +59,8 @@ namespace MiscServices { virtual void HideCurrentInput(MessageParcel& data) = 0; virtual void displayOptionalInputMethod(MessageParcel& data) = 0; - virtual int32_t getDisplayMode(int32_t retMode) = 0; - virtual int32_t getKeyboardWindowHeight(int32_t retHeight) = 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 *properties) = 0; virtual int32_t listInputMethod(std::vector *properties) = 0; diff --git a/services/include/input_method_system_ability.h b/services/include/input_method_system_ability.h index 1bf67a7..784d2d4 100644 --- a/services/include/input_method_system_ability.h +++ b/services/include/input_method_system_ability.h @@ -48,7 +48,7 @@ namespace MiscServices { int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; int32_t getDisplayMode(int32_t &retMode) override; - int32_t getKeyboardWindowHeight(int32_t retHeight) override; + int32_t getKeyboardWindowHeight(int32_t &retHeight) override; int32_t getCurrentKeyboardType(KeyboardType *retType) override; int32_t listInputMethodEnabled(std::vector *properties) override; int32_t listInputMethod(std::vector *properties) override; diff --git a/services/include/peruser_session.h b/services/include/peruser_session.h index 10c992e..7d36c80 100644 --- a/services/include/peruser_session.h +++ b/services/include/peruser_session.h @@ -107,7 +107,7 @@ namespace MiscServices { void OnPackageRemoved(const std::u16string& packageName); int GetDisplayMode(); - int GetKeyboardWindowHeight(int retHeight); + int GetKeyboardWindowHeight(int &retHeight); KeyboardType *GetCurrentKeyboardType(); int OnSettingChanged(const std::u16string& key, const std::u16string& value); diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index e24eb26..7c7c6e8 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -309,7 +309,7 @@ namespace MiscServices { \return ErrorCode::NO_ERROR no error \return ErrorCode::ERROR_USER_NOT_UNLOCKED user not unlocked */ - int32_t InputMethodSystemAbility::getKeyboardWindowHeight(int32_t retHeight) + int32_t InputMethodSystemAbility::getKeyboardWindowHeight(int32_t &retHeight) { int32_t uid = IPCSkeleton::GetCallingUid(); int32_t userId = getUserId(uid); diff --git a/services/src/peruser_session.cpp b/services/src/peruser_session.cpp index 39ea66f..1f87733 100644 --- a/services/src/peruser_session.cpp +++ b/services/src/peruser_session.cpp @@ -546,7 +546,7 @@ namespace MiscServices { \param[out] retHeight the height of keyboard window showing or showed returned to caller \return ErrorCode */ - int PerUserSession::GetKeyboardWindowHeight(int retHeight) + int PerUserSession::GetKeyboardWindowHeight(int &retHeight) { if (imsCore[lastImeIndex]) { int ret = imsCore[lastImeIndex]->getKeyboardWindowHeight(retHeight); From 3361e6cd2bed24aeebddc4f8dead897c964c4ba0 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Wed, 1 Jun 2022 19:53:51 +0800 Subject: [PATCH 05/11] Signed-off-by: lovechinamo Changes to be committed: --- services/src/input_method_system_ability.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index 7c7c6e8..aa9ab40 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -208,12 +208,14 @@ namespace MiscServices { std::map::const_iterator it = msgHandlers.find(MAIN_USER_ID); if (it == msgHandlers.end()) { IMSA_HILOGE("InputMethodSystemAbility::StartInputService() need start handler"); - sptr handler = new MessageHandler(); + MessageHandler *handler = new MessageHandler(); if (session) { IMSA_HILOGE("InputMethodSystemAbility::OnPrepareInput session is not nullptr"); session->CreateWorkThread(*handler); msgHandlers.insert(std::pair(MAIN_USER_ID, handler)); } + delete handler; + handler = nullptr; } bool isStartSuccess = false; From 4c4a7be473ad7d1e3cd21b19c408b0e1ca397d33 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Thu, 2 Jun 2022 09:22:25 +0800 Subject: [PATCH 06/11] Signed-off-by: lovechinamo Changes to be committed: --- .../include/i_input_method_core.h | 2 +- .../include/input_method_core_proxy.h | 2 +- .../include/input_method_core_stub.h | 2 +- .../src/input_method_core_proxy.cpp | 4 ++-- .../src/input_method_core_stub.cpp | 4 ++-- .../include/input_method_system_ability_proxy.h | 4 ++-- .../src/input_method_system_ability_proxy.cpp | 8 ++++---- services/include/i_input_method_system_ability.h | 4 ++-- services/include/input_method_system_ability.h | 4 ++-- services/include/peruser_session.h | 2 +- services/include/peruser_setting.h | 4 ++-- services/src/input_method_system_ability.cpp | 10 +++++----- services/src/input_method_system_ability_stub.cpp | 4 ++-- services/src/peruser_session.cpp | 2 +- services/src/peruser_setting.cpp | 12 ++++++------ 15 files changed, 34 insertions(+), 34 deletions(-) diff --git a/frameworks/inputmethod_ability/include/i_input_method_core.h b/frameworks/inputmethod_ability/include/i_input_method_core.h index 112aaac..b75bd43 100644 --- a/frameworks/inputmethod_ability/include/i_input_method_core.h +++ b/frameworks/inputmethod_ability/include/i_input_method_core.h @@ -56,7 +56,7 @@ namespace MiscServices { virtual bool showKeyboard(const sptr& inputDataChannel) = 0; virtual bool hideKeyboard(int32_t flags) = 0; virtual int32_t setKeyboardType(const KeyboardType& type) = 0; - virtual int32_t getKeyboardWindowHeight(int32_t &retHeight) = 0; + virtual int32_t getKeyboardWindowHeight(int32_t *retHeight) = 0; virtual int32_t InitInputControlChannel(sptr &inputControlChannel) = 0; virtual void SetClientState(bool state) = 0; virtual void StopInputService(std::string imeId) = 0; diff --git a/frameworks/inputmethod_ability/include/input_method_core_proxy.h b/frameworks/inputmethod_ability/include/input_method_core_proxy.h index eec719f..f49f968 100644 --- a/frameworks/inputmethod_ability/include/input_method_core_proxy.h +++ b/frameworks/inputmethod_ability/include/input_method_core_proxy.h @@ -43,7 +43,7 @@ namespace MiscServices { bool showKeyboard(const sptr& inputDataChannel) override; bool hideKeyboard(int32_t flags) override; int32_t setKeyboardType(const KeyboardType& type) override; - int32_t getKeyboardWindowHeight(int32_t &retHeight) override; + int32_t getKeyboardWindowHeight(int32_t *retHeight) override; int32_t InitInputControlChannel(sptr &inputControlChannel) override; void SetClientState(bool state) override; void StopInputService(std::string imeId) override; diff --git a/frameworks/inputmethod_ability/include/input_method_core_stub.h b/frameworks/inputmethod_ability/include/input_method_core_stub.h index 0e68056..3d05c44 100644 --- a/frameworks/inputmethod_ability/include/input_method_core_stub.h +++ b/frameworks/inputmethod_ability/include/input_method_core_stub.h @@ -52,7 +52,7 @@ namespace MiscServices { bool showKeyboard(const sptr& inputDataChannel) override; bool hideKeyboard(int32_t flags)override; int32_t setKeyboardType(const KeyboardType& type) override; - int32_t getKeyboardWindowHeight(int32_t &retHeight) override; + int32_t getKeyboardWindowHeight(int32_t *retHeight) override; int32_t InitInputControlChannel(sptr &inputControlChannel) override; void SetClientState(bool state) override; void StopInputService(std::string imeId) override; diff --git a/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp b/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp index 1626863..f681f37 100644 --- a/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp +++ b/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp @@ -287,7 +287,7 @@ namespace MiscServices { return code; } - int32_t InputMethodCoreProxy::getKeyboardWindowHeight(int32_t &retHeight) + int32_t InputMethodCoreProxy::getKeyboardWindowHeight(int32_t *retHeight) { IMSA_HILOGI("InputMethodCoreProxy::getKeyboardWindowHeight"); auto remote = Remote(); @@ -308,7 +308,7 @@ namespace MiscServices { if (code) { return code; } - retHeight = reply.ReadInt32(); + *retHeight = reply.ReadInt32(); return ErrorCode::NO_ERROR; } } // namespace MiscServices diff --git a/frameworks/inputmethod_ability/src/input_method_core_stub.cpp b/frameworks/inputmethod_ability/src/input_method_core_stub.cpp index e117853..c35831d 100644 --- a/frameworks/inputmethod_ability/src/input_method_core_stub.cpp +++ b/frameworks/inputmethod_ability/src/input_method_core_stub.cpp @@ -127,7 +127,7 @@ namespace MiscServices { } case GET_KEYBOARD_WINDOW_HEIGHT: { int32_t retHeight = 0; - getKeyboardWindowHeight(retHeight); + getKeyboardWindowHeight(&retHeight); reply.WriteNoException(); break; } @@ -287,7 +287,7 @@ namespace MiscServices { msgHandler_->SendMessage(msg); } - int32_t InputMethodCoreStub::getKeyboardWindowHeight(int32_t &retHeight) + int32_t InputMethodCoreStub::getKeyboardWindowHeight(int32_t *retHeight) { IMSA_HILOGI("InputMethodCoreStub::getKeyboardWindowHeight"); if (!msgHandler_) { diff --git a/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h b/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h index df30d91..b2f91d4 100644 --- a/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h +++ b/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h @@ -50,8 +50,8 @@ namespace MiscServices { int32_t Stop(sptr &client); void displayOptionalInputMethod(MessageParcel& data) override; - int32_t getDisplayMode(int32_t &retMode) override; - int32_t getKeyboardWindowHeight(int32_t &retHeight) override; + int32_t getDisplayMode(int32_t *retMode) override; + int32_t getKeyboardWindowHeight(int32_t *retHeight) override; int32_t getCurrentKeyboardType(KeyboardType *retType) override; int32_t listInputMethodEnabled(std::vector *properties) override; int32_t listInputMethod(std::vector *properties) override; diff --git a/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp b/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp index c639b6a..8db268a 100644 --- a/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp +++ b/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp @@ -255,7 +255,7 @@ namespace MiscServices { return NO_ERROR; } - int32_t InputMethodSystemAbilityProxy::getDisplayMode(int32_t &retMode) + int32_t InputMethodSystemAbilityProxy::getDisplayMode(int32_t *retMode) { MessageParcel data, reply; MessageOption option; @@ -274,13 +274,13 @@ namespace MiscServices { return ret; } - if (!reply.ReadInt32(retMode)) { + if (!reply.ReadInt32(*retMode)) { return ERROR_STATUS_BAD_VALUE; } return NO_ERROR; } - int32_t InputMethodSystemAbilityProxy::getKeyboardWindowHeight(int32_t &retHeight) + int32_t InputMethodSystemAbilityProxy::getKeyboardWindowHeight(int32_t *retHeight) { MessageParcel data, reply; MessageOption option; @@ -299,7 +299,7 @@ namespace MiscServices { return ret; } - if (!reply.ReadInt32(retHeight)) { + if (!reply.ReadInt32(*retHeight)) { return ERROR_STATUS_BAD_VALUE; } return NO_ERROR; diff --git a/services/include/i_input_method_system_ability.h b/services/include/i_input_method_system_ability.h index 53ea3ef..cb613a8 100644 --- a/services/include/i_input_method_system_ability.h +++ b/services/include/i_input_method_system_ability.h @@ -59,8 +59,8 @@ namespace MiscServices { virtual void HideCurrentInput(MessageParcel& data) = 0; virtual void displayOptionalInputMethod(MessageParcel& data) = 0; - virtual int32_t getDisplayMode(int32_t &retMode) = 0; - virtual int32_t getKeyboardWindowHeight(int32_t &retHeight) = 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 *properties) = 0; virtual int32_t listInputMethod(std::vector *properties) = 0; diff --git a/services/include/input_method_system_ability.h b/services/include/input_method_system_ability.h index 784d2d4..e04eda7 100644 --- a/services/include/input_method_system_ability.h +++ b/services/include/input_method_system_ability.h @@ -47,8 +47,8 @@ namespace MiscServices { int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - int32_t getDisplayMode(int32_t &retMode) override; - int32_t getKeyboardWindowHeight(int32_t &retHeight) override; + int32_t getDisplayMode(int32_t *retMode) override; + int32_t getKeyboardWindowHeight(int32_t *retHeight) override; int32_t getCurrentKeyboardType(KeyboardType *retType) override; int32_t listInputMethodEnabled(std::vector *properties) override; int32_t listInputMethod(std::vector *properties) override; diff --git a/services/include/peruser_session.h b/services/include/peruser_session.h index 7d36c80..89a7fc8 100644 --- a/services/include/peruser_session.h +++ b/services/include/peruser_session.h @@ -107,7 +107,7 @@ namespace MiscServices { void OnPackageRemoved(const std::u16string& packageName); int GetDisplayMode(); - int GetKeyboardWindowHeight(int &retHeight); + int GetKeyboardWindowHeight(int *retHeight); KeyboardType *GetCurrentKeyboardType(); int OnSettingChanged(const std::u16string& key, const std::u16string& value); diff --git a/services/include/peruser_setting.h b/services/include/peruser_setting.h index c69298c..c6eba1d 100644 --- a/services/include/peruser_setting.h +++ b/services/include/peruser_setting.h @@ -39,8 +39,8 @@ namespace MiscServices { InputMethodSetting *GetInputMethodSetting(); InputMethodProperty *GetInputMethodProperty(const std::u16string& imeId); - int32_t OnPackageAdded(std::u16string& packageName, bool &isSecurityIme); - int32_t OnPackageRemoved(std::u16string& packageName, bool &isSecurityIme); + 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(); diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index aa9ab40..7fac080 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -287,7 +287,7 @@ namespace MiscServices { \return ErrorCode::NO_ERROR no error \return ErrorCode::ERROR_USER_NOT_UNLOCKED user not unlocked */ - int32_t InputMethodSystemAbility::getDisplayMode(int32_t &retMode) + int32_t InputMethodSystemAbility::getDisplayMode(int32_t *retMode) { int32_t uid = IPCSkeleton::GetCallingUid(); int32_t userId = getUserId(uid); @@ -301,7 +301,7 @@ namespace MiscServices { IMSA_HILOGI("InputMethodSystemAbility::getDisplayMode session is nullptr"); return ErrorCode::ERROR_NULL_POINTER; } - retMode = session->GetDisplayMode(); + *retMode = session->GetDisplayMode(); return ErrorCode::NO_ERROR; } @@ -311,7 +311,7 @@ namespace MiscServices { \return ErrorCode::NO_ERROR no error \return ErrorCode::ERROR_USER_NOT_UNLOCKED user not unlocked */ - int32_t InputMethodSystemAbility::getKeyboardWindowHeight(int32_t &retHeight) + int32_t InputMethodSystemAbility::getKeyboardWindowHeight(int32_t *retHeight) { int32_t uid = IPCSkeleton::GetCallingUid(); int32_t userId = getUserId(uid); @@ -772,7 +772,7 @@ namespace MiscServices { return ErrorCode::ERROR_USER_NOT_UNLOCKED; } bool securityImeFlag = false; - int32_t ret = setting->OnPackageAdded(packageName, securityImeFlag); + int32_t ret = setting->OnPackageAdded(packageName, &securityImeFlag); if (ret != ErrorCode::NO_ERROR) { IMSA_HILOGI("End...\n"); return ret; @@ -826,7 +826,7 @@ namespace MiscServices { } session->OnPackageRemoved(packageName); bool securityImeFlag = false; - int32_t ret = setting->OnPackageRemoved(packageName, securityImeFlag); + int32_t ret = setting->OnPackageRemoved(packageName, &securityImeFlag); if (ret != ErrorCode::NO_ERROR) { IMSA_HILOGI("End...\n"); return ret; diff --git a/services/src/input_method_system_ability_stub.cpp b/services/src/input_method_system_ability_stub.cpp index 2dd37f0..0f50fab 100644 --- a/services/src/input_method_system_ability_stub.cpp +++ b/services/src/input_method_system_ability_stub.cpp @@ -69,7 +69,7 @@ namespace MiscServices { } case GET_DISPLAY_MODE: { int32_t mode = 0; - int32_t status = getDisplayMode(mode); + int32_t status = getDisplayMode(&mode); if (status == ErrorCode::NO_ERROR) { reply.WriteInt32(NO_ERROR); reply.WriteInt32(mode); @@ -81,7 +81,7 @@ namespace MiscServices { } case GET_KEYBOARD_WINDOW_HEIGHT: { int32_t height = 0; - int32_t status = getKeyboardWindowHeight(height); + int32_t status = getKeyboardWindowHeight(&height); if (status == ErrorCode::NO_ERROR) { reply.WriteInt32(NO_ERROR); reply.WriteInt32(height); diff --git a/services/src/peruser_session.cpp b/services/src/peruser_session.cpp index 1f87733..973b8c8 100644 --- a/services/src/peruser_session.cpp +++ b/services/src/peruser_session.cpp @@ -546,7 +546,7 @@ namespace MiscServices { \param[out] retHeight the height of keyboard window showing or showed returned to caller \return ErrorCode */ - int PerUserSession::GetKeyboardWindowHeight(int &retHeight) + int PerUserSession::GetKeyboardWindowHeight(int *retHeight) { if (imsCore[lastImeIndex]) { int ret = imsCore[lastImeIndex]->getKeyboardWindowHeight(retHeight); diff --git a/services/src/peruser_setting.cpp b/services/src/peruser_setting.cpp index 2fc1d64..a945e2e 100644 --- a/services/src/peruser_setting.cpp +++ b/services/src/peruser_setting.cpp @@ -76,10 +76,10 @@ namespace MiscServices { * ErrorCode::ERROR_NOT_IME_PACKAGE The installed package is not an IME package. * ErrorCode::ERROR_IME_PACKAGE_DUPLICATED The installed package is duplicated. */ - int PerUserSetting::OnPackageAdded(std::u16string& packageName, bool &isSecurityIme) + int PerUserSetting::OnPackageAdded(std::u16string& packageName, bool *isSecurityIme) { - if (isSecurityIme) { - isSecurityIme = false; + if (*isSecurityIme) { + *isSecurityIme = false; } std::u16string imeId = GetImeId(packageName); if (imeId.size()) { @@ -97,8 +97,8 @@ namespace MiscServices { } inputMethodProperties.push_back(property); if (CheckIfSecurityIme(*property)) { - if (isSecurityIme) { - isSecurityIme = true; + if (*isSecurityIme) { + *isSecurityIme = true; } return ErrorCode::NO_ERROR; } @@ -126,7 +126,7 @@ namespace MiscServices { * and is removed from the input method management system * ErrorCode::ERROR_NOT_IME_PACKAGE The removed package is not an IME package. */ - int PerUserSetting::OnPackageRemoved(std::u16string& packageName, bool &isSecurityIme) + int PerUserSetting::OnPackageRemoved(std::u16string& packageName, bool *isSecurityIme) { if (isSecurityIme) { isSecurityIme = false; From 7ff1253da6da596961f05df0b0367431af85d6e6 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Thu, 2 Jun 2022 09:52:25 +0800 Subject: [PATCH 07/11] Signed-off-by: lovechinamo Changes to be committed: --- services/src/peruser_setting.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/src/peruser_setting.cpp b/services/src/peruser_setting.cpp index a945e2e..e0ee0cd 100644 --- a/services/src/peruser_setting.cpp +++ b/services/src/peruser_setting.cpp @@ -128,8 +128,8 @@ namespace MiscServices { */ int PerUserSetting::OnPackageRemoved(std::u16string& packageName, bool *isSecurityIme) { - if (isSecurityIme) { - isSecurityIme = false; + if (*isSecurityIme) { + *isSecurityIme = false; } std::u16string imeId = GetImeId(packageName); if (!imeId.size()) { @@ -151,8 +151,8 @@ namespace MiscServices { } } if (securityFlag) { - if (isSecurityIme) { - isSecurityIme = true; + if (*isSecurityIme) { + *isSecurityIme = true; } return ErrorCode::NO_ERROR; } From d35b01540c2fc7516a63c02d4c90cc5fb29c32ac Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Thu, 2 Jun 2022 14:56:03 +0800 Subject: [PATCH 08/11] Signed-off-by: lovechinamo Changes to be committed: --- .../inputmethod_ability/include/i_input_method_core.h | 2 +- .../include/input_method_core_proxy.h | 2 +- .../include/input_method_core_stub.h | 2 +- .../src/input_method_core_proxy.cpp | 2 +- .../inputmethod_ability/src/input_method_core_stub.cpp | 4 ++-- .../include/input_method_system_ability_proxy.h | 4 ++-- .../src/input_method_system_ability_proxy.cpp | 4 ++-- services/include/i_input_method_system_ability.h | 4 ++-- services/include/input_method_system_ability.h | 4 ++-- services/include/peruser_session.h | 2 +- services/include/peruser_setting.h | 4 ++-- services/src/input_method_system_ability.cpp | 10 ++++------ services/src/input_method_system_ability_stub.cpp | 4 ++-- services/src/peruser_session.cpp | 2 +- services/src/peruser_setting.cpp | 4 ++-- 15 files changed, 26 insertions(+), 28 deletions(-) diff --git a/frameworks/inputmethod_ability/include/i_input_method_core.h b/frameworks/inputmethod_ability/include/i_input_method_core.h index b75bd43..112aaac 100644 --- a/frameworks/inputmethod_ability/include/i_input_method_core.h +++ b/frameworks/inputmethod_ability/include/i_input_method_core.h @@ -56,7 +56,7 @@ namespace MiscServices { virtual bool showKeyboard(const sptr& inputDataChannel) = 0; virtual bool hideKeyboard(int32_t flags) = 0; virtual int32_t setKeyboardType(const KeyboardType& type) = 0; - virtual int32_t getKeyboardWindowHeight(int32_t *retHeight) = 0; + virtual int32_t getKeyboardWindowHeight(int32_t &retHeight) = 0; virtual int32_t InitInputControlChannel(sptr &inputControlChannel) = 0; virtual void SetClientState(bool state) = 0; virtual void StopInputService(std::string imeId) = 0; diff --git a/frameworks/inputmethod_ability/include/input_method_core_proxy.h b/frameworks/inputmethod_ability/include/input_method_core_proxy.h index f49f968..eec719f 100644 --- a/frameworks/inputmethod_ability/include/input_method_core_proxy.h +++ b/frameworks/inputmethod_ability/include/input_method_core_proxy.h @@ -43,7 +43,7 @@ namespace MiscServices { bool showKeyboard(const sptr& inputDataChannel) override; bool hideKeyboard(int32_t flags) override; int32_t setKeyboardType(const KeyboardType& type) override; - int32_t getKeyboardWindowHeight(int32_t *retHeight) override; + int32_t getKeyboardWindowHeight(int32_t &retHeight) override; int32_t InitInputControlChannel(sptr &inputControlChannel) override; void SetClientState(bool state) override; void StopInputService(std::string imeId) override; diff --git a/frameworks/inputmethod_ability/include/input_method_core_stub.h b/frameworks/inputmethod_ability/include/input_method_core_stub.h index 3d05c44..0e68056 100644 --- a/frameworks/inputmethod_ability/include/input_method_core_stub.h +++ b/frameworks/inputmethod_ability/include/input_method_core_stub.h @@ -52,7 +52,7 @@ namespace MiscServices { bool showKeyboard(const sptr& inputDataChannel) override; bool hideKeyboard(int32_t flags)override; int32_t setKeyboardType(const KeyboardType& type) override; - int32_t getKeyboardWindowHeight(int32_t *retHeight) override; + int32_t getKeyboardWindowHeight(int32_t &retHeight) override; int32_t InitInputControlChannel(sptr &inputControlChannel) override; void SetClientState(bool state) override; void StopInputService(std::string imeId) override; diff --git a/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp b/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp index f681f37..e25cd1c 100644 --- a/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp +++ b/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp @@ -287,7 +287,7 @@ namespace MiscServices { return code; } - int32_t InputMethodCoreProxy::getKeyboardWindowHeight(int32_t *retHeight) + int32_t InputMethodCoreProxy::getKeyboardWindowHeight(int32_t &retHeight) { IMSA_HILOGI("InputMethodCoreProxy::getKeyboardWindowHeight"); auto remote = Remote(); diff --git a/frameworks/inputmethod_ability/src/input_method_core_stub.cpp b/frameworks/inputmethod_ability/src/input_method_core_stub.cpp index c35831d..e117853 100644 --- a/frameworks/inputmethod_ability/src/input_method_core_stub.cpp +++ b/frameworks/inputmethod_ability/src/input_method_core_stub.cpp @@ -127,7 +127,7 @@ namespace MiscServices { } case GET_KEYBOARD_WINDOW_HEIGHT: { int32_t retHeight = 0; - getKeyboardWindowHeight(&retHeight); + getKeyboardWindowHeight(retHeight); reply.WriteNoException(); break; } @@ -287,7 +287,7 @@ namespace MiscServices { msgHandler_->SendMessage(msg); } - int32_t InputMethodCoreStub::getKeyboardWindowHeight(int32_t *retHeight) + int32_t InputMethodCoreStub::getKeyboardWindowHeight(int32_t &retHeight) { IMSA_HILOGI("InputMethodCoreStub::getKeyboardWindowHeight"); if (!msgHandler_) { diff --git a/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h b/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h index b2f91d4..df30d91 100644 --- a/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h +++ b/frameworks/inputmethod_controller/include/input_method_system_ability_proxy.h @@ -50,8 +50,8 @@ namespace MiscServices { int32_t Stop(sptr &client); void displayOptionalInputMethod(MessageParcel& data) override; - int32_t getDisplayMode(int32_t *retMode) override; - int32_t getKeyboardWindowHeight(int32_t *retHeight) override; + int32_t getDisplayMode(int32_t &retMode) override; + int32_t getKeyboardWindowHeight(int32_t &retHeight) override; int32_t getCurrentKeyboardType(KeyboardType *retType) override; int32_t listInputMethodEnabled(std::vector *properties) override; int32_t listInputMethod(std::vector *properties) override; diff --git a/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp b/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp index 8db268a..3924212 100644 --- a/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp +++ b/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp @@ -255,7 +255,7 @@ namespace MiscServices { return NO_ERROR; } - int32_t InputMethodSystemAbilityProxy::getDisplayMode(int32_t *retMode) + int32_t InputMethodSystemAbilityProxy::getDisplayMode(int32_t &retMode) { MessageParcel data, reply; MessageOption option; @@ -280,7 +280,7 @@ namespace MiscServices { return NO_ERROR; } - int32_t InputMethodSystemAbilityProxy::getKeyboardWindowHeight(int32_t *retHeight) + int32_t InputMethodSystemAbilityProxy::getKeyboardWindowHeight(int32_t &retHeight) { MessageParcel data, reply; MessageOption option; diff --git a/services/include/i_input_method_system_ability.h b/services/include/i_input_method_system_ability.h index cb613a8..53ea3ef 100644 --- a/services/include/i_input_method_system_ability.h +++ b/services/include/i_input_method_system_ability.h @@ -59,8 +59,8 @@ namespace MiscServices { virtual void HideCurrentInput(MessageParcel& data) = 0; virtual void displayOptionalInputMethod(MessageParcel& data) = 0; - virtual int32_t getDisplayMode(int32_t *retMode) = 0; - virtual int32_t getKeyboardWindowHeight(int32_t *retHeight) = 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 *properties) = 0; virtual int32_t listInputMethod(std::vector *properties) = 0; diff --git a/services/include/input_method_system_ability.h b/services/include/input_method_system_ability.h index e04eda7..784d2d4 100644 --- a/services/include/input_method_system_ability.h +++ b/services/include/input_method_system_ability.h @@ -47,8 +47,8 @@ namespace MiscServices { int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - int32_t getDisplayMode(int32_t *retMode) override; - int32_t getKeyboardWindowHeight(int32_t *retHeight) override; + int32_t getDisplayMode(int32_t &retMode) override; + int32_t getKeyboardWindowHeight(int32_t &retHeight) override; int32_t getCurrentKeyboardType(KeyboardType *retType) override; int32_t listInputMethodEnabled(std::vector *properties) override; int32_t listInputMethod(std::vector *properties) override; diff --git a/services/include/peruser_session.h b/services/include/peruser_session.h index 89a7fc8..7d36c80 100644 --- a/services/include/peruser_session.h +++ b/services/include/peruser_session.h @@ -107,7 +107,7 @@ namespace MiscServices { void OnPackageRemoved(const std::u16string& packageName); int GetDisplayMode(); - int GetKeyboardWindowHeight(int *retHeight); + int GetKeyboardWindowHeight(int &retHeight); KeyboardType *GetCurrentKeyboardType(); int OnSettingChanged(const std::u16string& key, const std::u16string& value); diff --git a/services/include/peruser_setting.h b/services/include/peruser_setting.h index c6eba1d..c69298c 100644 --- a/services/include/peruser_setting.h +++ b/services/include/peruser_setting.h @@ -39,8 +39,8 @@ namespace MiscServices { InputMethodSetting *GetInputMethodSetting(); InputMethodProperty *GetInputMethodProperty(const std::u16string& imeId); - int32_t OnPackageAdded(std::u16string& packageName, bool *isSecurityIme); - int32_t OnPackageRemoved(std::u16string& packageName, bool *isSecurityIme); + 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(); diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index 7fac080..7edec2e 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -214,8 +214,6 @@ namespace MiscServices { session->CreateWorkThread(*handler); msgHandlers.insert(std::pair(MAIN_USER_ID, handler)); } - delete handler; - handler = nullptr; } bool isStartSuccess = false; @@ -287,7 +285,7 @@ namespace MiscServices { \return ErrorCode::NO_ERROR no error \return ErrorCode::ERROR_USER_NOT_UNLOCKED user not unlocked */ - int32_t InputMethodSystemAbility::getDisplayMode(int32_t *retMode) + int32_t InputMethodSystemAbility::getDisplayMode(int32_t &retMode) { int32_t uid = IPCSkeleton::GetCallingUid(); int32_t userId = getUserId(uid); @@ -311,7 +309,7 @@ namespace MiscServices { \return ErrorCode::NO_ERROR no error \return ErrorCode::ERROR_USER_NOT_UNLOCKED user not unlocked */ - int32_t InputMethodSystemAbility::getKeyboardWindowHeight(int32_t *retHeight) + int32_t InputMethodSystemAbility::getKeyboardWindowHeight(int32_t &retHeight) { int32_t uid = IPCSkeleton::GetCallingUid(); int32_t userId = getUserId(uid); @@ -772,7 +770,7 @@ namespace MiscServices { return ErrorCode::ERROR_USER_NOT_UNLOCKED; } bool securityImeFlag = false; - int32_t ret = setting->OnPackageAdded(packageName, &securityImeFlag); + int32_t ret = setting->OnPackageAdded(packageName, securityImeFlag); if (ret != ErrorCode::NO_ERROR) { IMSA_HILOGI("End...\n"); return ret; @@ -826,7 +824,7 @@ namespace MiscServices { } session->OnPackageRemoved(packageName); bool securityImeFlag = false; - int32_t ret = setting->OnPackageRemoved(packageName, &securityImeFlag); + int32_t ret = setting->OnPackageRemoved(packageName, securityImeFlag); if (ret != ErrorCode::NO_ERROR) { IMSA_HILOGI("End...\n"); return ret; diff --git a/services/src/input_method_system_ability_stub.cpp b/services/src/input_method_system_ability_stub.cpp index 0f50fab..2dd37f0 100644 --- a/services/src/input_method_system_ability_stub.cpp +++ b/services/src/input_method_system_ability_stub.cpp @@ -69,7 +69,7 @@ namespace MiscServices { } case GET_DISPLAY_MODE: { int32_t mode = 0; - int32_t status = getDisplayMode(&mode); + int32_t status = getDisplayMode(mode); if (status == ErrorCode::NO_ERROR) { reply.WriteInt32(NO_ERROR); reply.WriteInt32(mode); @@ -81,7 +81,7 @@ namespace MiscServices { } case GET_KEYBOARD_WINDOW_HEIGHT: { int32_t height = 0; - int32_t status = getKeyboardWindowHeight(&height); + int32_t status = getKeyboardWindowHeight(height); if (status == ErrorCode::NO_ERROR) { reply.WriteInt32(NO_ERROR); reply.WriteInt32(height); diff --git a/services/src/peruser_session.cpp b/services/src/peruser_session.cpp index 973b8c8..1f87733 100644 --- a/services/src/peruser_session.cpp +++ b/services/src/peruser_session.cpp @@ -546,7 +546,7 @@ namespace MiscServices { \param[out] retHeight the height of keyboard window showing or showed returned to caller \return ErrorCode */ - int PerUserSession::GetKeyboardWindowHeight(int *retHeight) + int PerUserSession::GetKeyboardWindowHeight(int &retHeight) { if (imsCore[lastImeIndex]) { int ret = imsCore[lastImeIndex]->getKeyboardWindowHeight(retHeight); diff --git a/services/src/peruser_setting.cpp b/services/src/peruser_setting.cpp index e0ee0cd..ba74239 100644 --- a/services/src/peruser_setting.cpp +++ b/services/src/peruser_setting.cpp @@ -76,7 +76,7 @@ namespace MiscServices { * ErrorCode::ERROR_NOT_IME_PACKAGE The installed package is not an IME package. * ErrorCode::ERROR_IME_PACKAGE_DUPLICATED The installed package is duplicated. */ - int PerUserSetting::OnPackageAdded(std::u16string& packageName, bool *isSecurityIme) + int PerUserSetting::OnPackageAdded(std::u16string& packageName, bool &isSecurityIme) { if (*isSecurityIme) { *isSecurityIme = false; @@ -126,7 +126,7 @@ namespace MiscServices { * and is removed from the input method management system * ErrorCode::ERROR_NOT_IME_PACKAGE The removed package is not an IME package. */ - int PerUserSetting::OnPackageRemoved(std::u16string& packageName, bool *isSecurityIme) + int PerUserSetting::OnPackageRemoved(std::u16string& packageName, bool &isSecurityIme) { if (*isSecurityIme) { *isSecurityIme = false; From a5b57e28ca4b3138cf655224e2853677f5dc9f87 Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Thu, 2 Jun 2022 15:04:40 +0800 Subject: [PATCH 09/11] Signed-off-by: lovechinamo Changes to be committed: --- .../src/input_method_core_proxy.cpp | 2 +- .../src/input_method_system_ability_proxy.cpp | 4 ++-- services/src/peruser_setting.cpp | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp b/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp index e25cd1c..1626863 100644 --- a/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp +++ b/frameworks/inputmethod_ability/src/input_method_core_proxy.cpp @@ -308,7 +308,7 @@ namespace MiscServices { if (code) { return code; } - *retHeight = reply.ReadInt32(); + retHeight = reply.ReadInt32(); return ErrorCode::NO_ERROR; } } // namespace MiscServices diff --git a/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp b/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp index 3924212..c639b6a 100644 --- a/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp +++ b/frameworks/inputmethod_controller/src/input_method_system_ability_proxy.cpp @@ -274,7 +274,7 @@ namespace MiscServices { return ret; } - if (!reply.ReadInt32(*retMode)) { + if (!reply.ReadInt32(retMode)) { return ERROR_STATUS_BAD_VALUE; } return NO_ERROR; @@ -299,7 +299,7 @@ namespace MiscServices { return ret; } - if (!reply.ReadInt32(*retHeight)) { + if (!reply.ReadInt32(retHeight)) { return ERROR_STATUS_BAD_VALUE; } return NO_ERROR; diff --git a/services/src/peruser_setting.cpp b/services/src/peruser_setting.cpp index ba74239..2fc1d64 100644 --- a/services/src/peruser_setting.cpp +++ b/services/src/peruser_setting.cpp @@ -78,8 +78,8 @@ namespace MiscServices { */ int PerUserSetting::OnPackageAdded(std::u16string& packageName, bool &isSecurityIme) { - if (*isSecurityIme) { - *isSecurityIme = false; + if (isSecurityIme) { + isSecurityIme = false; } std::u16string imeId = GetImeId(packageName); if (imeId.size()) { @@ -97,8 +97,8 @@ namespace MiscServices { } inputMethodProperties.push_back(property); if (CheckIfSecurityIme(*property)) { - if (*isSecurityIme) { - *isSecurityIme = true; + if (isSecurityIme) { + isSecurityIme = true; } return ErrorCode::NO_ERROR; } @@ -128,8 +128,8 @@ namespace MiscServices { */ int PerUserSetting::OnPackageRemoved(std::u16string& packageName, bool &isSecurityIme) { - if (*isSecurityIme) { - *isSecurityIme = false; + if (isSecurityIme) { + isSecurityIme = false; } std::u16string imeId = GetImeId(packageName); if (!imeId.size()) { @@ -151,8 +151,8 @@ namespace MiscServices { } } if (securityFlag) { - if (*isSecurityIme) { - *isSecurityIme = true; + if (isSecurityIme) { + isSecurityIme = true; } return ErrorCode::NO_ERROR; } From 573763a610795c4f71897e618a6d95c2072b416f Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Thu, 2 Jun 2022 16:30:42 +0800 Subject: [PATCH 10/11] Signed-off-by: lovechinamo Changes to be committed: --- services/src/input_method_system_ability.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index 7edec2e..d0744c2 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -299,7 +299,7 @@ namespace MiscServices { IMSA_HILOGI("InputMethodSystemAbility::getDisplayMode session is nullptr"); return ErrorCode::ERROR_NULL_POINTER; } - *retMode = session->GetDisplayMode(); + retMode = session->GetDisplayMode(); return ErrorCode::NO_ERROR; } From ad9623dad1004029421d87e1351431fc0b8aaedf Mon Sep 17 00:00:00 2001 From: lovechinamo Date: Mon, 6 Jun 2022 14:42:30 +0800 Subject: [PATCH 11/11] Signed-off-by: lovechinamo Changes to be committed: --- services/src/peruser_session.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/src/peruser_session.cpp b/services/src/peruser_session.cpp index 1f87733..72779ce 100644 --- a/services/src/peruser_session.cpp +++ b/services/src/peruser_session.cpp @@ -237,7 +237,7 @@ namespace MiscServices { { IMSA_HILOGI("PerUserSession::ResetIme"); std::unique_lock lock(mtx); - InputMethodProperty *ime[2] = {defaultIme, securityIme}; + InputMethodProperty *ime[] = {defaultIme, securityIme}; for (int i = 0; i < MIN_IME; i++) { if (currentIme[i] == ime[i] && ime[i]) { continue;