From 635d389021a20c65897ba00bbc6e3189dbce2ac5 Mon Sep 17 00:00:00 2001 From: qianyong325 Date: Thu, 26 Jun 2025 10:23:53 +0800 Subject: [PATCH] code fix Signed-off-by: qianyong325 --- common/include/inputmethod_message_handler.h | 1 + frameworks/common/block_data.h | 8 + .../src/input_data_channel_proxy_wrap.cpp | 13 +- services/include/im_common_event_manager.h | 1 + .../include/input_method_system_ability.h | 1 + services/include/peruser_session.h | 7 +- services/src/im_common_event_manager.cpp | 28 ++++ services/src/input_method_system_ability.cpp | 32 ++++ services/src/peruser_session.cpp | 67 ++++++--- .../src/input_method_private_member_test.cpp | 140 +++++++++++------- 10 files changed, 210 insertions(+), 88 deletions(-) diff --git a/common/include/inputmethod_message_handler.h b/common/include/inputmethod_message_handler.h index f462bbeaf..219211392 100644 --- a/common/include/inputmethod_message_handler.h +++ b/common/include/inputmethod_message_handler.h @@ -39,6 +39,7 @@ enum { MSG_ID_OS_ACCOUNT_STARTED, MSG_ID_BOOT_COMPLETED, MSG_ID_SCREEN_UNLOCK, + MSG_ID_SCREEN_LOCK, MSG_ID_SELECT_BY_RANGE, MSG_ID_SELECT_BY_MOVEMENT, MSG_ID_HANDLE_EXTEND_ACTION, diff --git a/frameworks/common/block_data.h b/frameworks/common/block_data.h index 33142d873..c49569064 100644 --- a/frameworks/common/block_data.h +++ b/frameworks/common/block_data.h @@ -56,6 +56,14 @@ public: return isSet_; } + T GetValueWithoutTimeout() + { + std::unique_lock lock(mutex_); + cv_.wait(lock, [this]() { return isSet_; }); + T data = data_; + return data; + } + void Clear(const T &invalid = T()) { std::lock_guard lock(mutex_); diff --git a/frameworks/native/inputmethod_ability/src/input_data_channel_proxy_wrap.cpp b/frameworks/native/inputmethod_ability/src/input_data_channel_proxy_wrap.cpp index b72ef9dac..a18ed5349 100644 --- a/frameworks/native/inputmethod_ability/src/input_data_channel_proxy_wrap.cpp +++ b/frameworks/native/inputmethod_ability/src/input_data_channel_proxy_wrap.cpp @@ -71,9 +71,11 @@ int32_t InputDataChannelProxyWrap::GetTextBeforeCursor( }; SyncOutput output = nullptr; if (callback == nullptr) { - output = [&text](const ResponseData &data) -> void { VariantUtil::GetValue(data, text); }; + output = [&text](const ResponseData &data) -> void { + VariantUtil::GetValue(data, text); + IMSA_HILOGD("text:%{public}s.", text.c_str()); + }; } - return Request(callback, work, callback == nullptr, output); } @@ -241,6 +243,7 @@ int32_t InputDataChannelProxyWrap::HandleResponse(uint64_t msgId, const Response rspHandlers_.erase(it); return ErrorCode::NO_ERROR; } + IMSA_HILOGD("rsp info id: %{public}" PRIu64 " ret: %{public}d", msgId, rspInfo.dealRet_); if (it->second->syncBlockData_ != nullptr) { it->second->syncBlockData_->SetValue(rspInfo); } @@ -257,10 +260,8 @@ int32_t InputDataChannelProxyWrap::WaitResponse( if (handler == nullptr || handler->syncBlockData_ == nullptr) { return ErrorCode::ERROR_IMA_DATA_CHANNEL_ABNORMAL; } - ResponseInfo rspInfo; - if (!handler->syncBlockData_->GetValue(rspInfo)) { - return ErrorCode::ERROR_IMA_DATA_CHANNEL_ABNORMAL; - } + ResponseInfo rspInfo = handler->syncBlockData_->GetValueWithoutTimeout(); + IMSA_HILOGD("rsp info id: %{public}" PRIu64 " ret: %{public}d", handler->msgId_, rspInfo.dealRet_); if (rspInfo.dealRet_ != ErrorCode::NO_ERROR) { return rspInfo.dealRet_; } diff --git a/services/include/im_common_event_manager.h b/services/include/im_common_event_manager.h index 17a444d1d..7e9bbeb2a 100644 --- a/services/include/im_common_event_manager.h +++ b/services/include/im_common_event_manager.h @@ -52,6 +52,7 @@ public: void ChangePackage(const EventFwk::CommonEventData &data); void HandleBootCompleted(const EventFwk::CommonEventData &data); void OnScreenUnlock(const EventFwk::CommonEventData &data); + void OnScreenLock(const EventFwk::CommonEventData &data); private: using EventListenerFunc = std::function; diff --git a/services/include/input_method_system_ability.h b/services/include/input_method_system_ability.h index 117ba39d7..a2fea85a9 100644 --- a/services/include/input_method_system_ability.h +++ b/services/include/input_method_system_ability.h @@ -130,6 +130,7 @@ private: int32_t HandlePackageEvent(const Message *msg); int32_t OnPackageRemoved(int32_t userId, const std::string &packageName); void OnScreenUnlock(const Message *msg); + void OnScreenLock(const Message *msg); int32_t OnDisplayOptionalInputMethod(); void SubscribeCommonEvent(); int32_t Switch(int32_t userId, const std::string &bundleName, const std::shared_ptr &info); diff --git a/services/include/peruser_session.h b/services/include/peruser_session.h index 086661701..8ddc84dd0 100644 --- a/services/include/peruser_session.h +++ b/services/include/peruser_session.h @@ -104,6 +104,7 @@ public: void OnFocused(uint64_t displayId, int32_t pid, int32_t uid); void OnUnfocused(uint64_t displayId, int32_t pid, int32_t uid); void OnScreenUnlock(); + void OnScreenLock(); int64_t GetCurrentClientPid(uint64_t displayId); int64_t GetInactiveClientPid(uint64_t displayId); int32_t OnPanelStatusChange(const InputWindowStatus &status, const ImeWindowInfo &info, uint64_t displayId); @@ -153,6 +154,7 @@ public: bool IsNumkeyAutoInputApp(const std::string &bundleName); std::pair GetCurrentInputPattern(); bool IsPreconfiguredDefaultImeSpecified(const InputClientInfo &inputClientInfo); + bool IsSimpleKeyboardEnabled(); bool AllowSwitchImeByCombinationKey(); std::pair StartPreconfiguredDefaultIme( uint64_t callingDisplayId, const ImeExtendInfo &imeExtendInfo = {}, bool isStopCurrentIme = false); @@ -244,7 +246,8 @@ private: bool GetCallingWindowInfo(const InputClientInfo &clientInfo, Rosen::CallingWindowInfo &callingWindowInfo); int32_t SendPrivateData(const std::unordered_map &privateCommand); void ClearRequestKeyboardReason(std::shared_ptr &clientInfo); - std::shared_ptr GetRealCurrentIme(bool needSwitchToPresetImeIfNoCurIme = false); + std::pair GetImeUsedBeforeScreenLocked(); + void SetImeUsedBeforeScreenLocked(const std::pair &ime); std::mutex imeStartLock_; @@ -285,6 +288,8 @@ private: std::atomic agentDisplayId_{ DEFAULT_DISPLAY_ID }; std::mutex clientGroupLock_{}; std::unordered_map> clientGroupMap_; + std::mutex imeUsedLock_; + std::pair imeUsedBeforeScreenLocked_; }; } // namespace MiscServices } // namespace OHOS diff --git a/services/src/im_common_event_manager.cpp b/services/src/im_common_event_manager.cpp index 0861e98e9..c01395192 100644 --- a/services/src/im_common_event_manager.cpp +++ b/services/src/im_common_event_manager.cpp @@ -65,6 +65,7 @@ bool ImCommonEventManager::SubscribeEvent() matchingSkills.AddEvent(CommonEventSupport::COMMON_EVENT_USER_STOPPED); matchingSkills.AddEvent(CommonEventSupport::COMMON_EVENT_BOOT_COMPLETED); matchingSkills.AddEvent(CommonEventSupport::COMMON_EVENT_SCREEN_UNLOCKED); + matchingSkills.AddEvent(CommonEventSupport::COMMON_EVENT_SCREEN_LOCKED); EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills); @@ -179,6 +180,10 @@ ImCommonEventManager::EventSubscriber::EventSubscriber(const EventFwk::CommonEve [] (EventSubscriber *that, const EventFwk::CommonEventData &data) { return that->OnScreenUnlock(data); }; + EventManagerFunc_[CommonEventSupport::COMMON_EVENT_SCREEN_LOCKED] = + [] (EventSubscriber *that, const EventFwk::CommonEventData &data) { + return that->OnScreenLock(data); + }; } void ImCommonEventManager::EventSubscriber::OnReceiveEvent(const EventFwk::CommonEventData &data) @@ -343,6 +348,29 @@ void ImCommonEventManager::EventSubscriber::OnScreenUnlock(const EventFwk::Commo MessageHandler::Instance()->SendMessage(msg); } +void ImCommonEventManager::EventSubscriber::OnScreenLock(const EventFwk::CommonEventData &data) +{ + MessageParcel *parcel = new (std::nothrow) MessageParcel(); + if (parcel == nullptr) { + IMSA_HILOGE("parcel is nullptr!"); + return; + } + auto const &want = data.GetWant(); + int32_t userId = want.GetIntParam("userId", OsAccountAdapter::INVALID_USER_ID); + if (!ITypesUtil::Marshal(*parcel, userId)) { + IMSA_HILOGE("Failed to write message parcel!"); + delete parcel; + return; + } + Message *msg = new (std::nothrow) Message(MessageID::MSG_ID_SCREEN_LOCK, parcel); + if (msg == nullptr) { + IMSA_HILOGE("failed to create Message!"); + delete parcel; + return; + } + MessageHandler::Instance()->SendMessage(msg); +} + ImCommonEventManager::SystemAbilityStatusChangeListener::SystemAbilityStatusChangeListener(std::function func) : func_(std::move(func)) { diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index ecfc81aaf..e6e33f233 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -1521,6 +1521,10 @@ void InputMethodSystemAbility::WorkThread() OnScreenUnlock(msg); break; } + case MSG_ID_SCREEN_LOCK: { + OnScreenLock(msg); + break; + } case MSG_ID_REGULAR_UPDATE_IME_INFO: { FullImeInfoManager::GetInstance().RegularInit(); break; @@ -1663,6 +1667,30 @@ void InputMethodSystemAbility::OnScreenUnlock(const Message *msg) session->OnScreenUnlock(); } +void InputMethodSystemAbility::OnScreenLock(const Message *msg) +{ + if (msg == nullptr || msg->msgContent_ == nullptr) { + IMSA_HILOGE("message is nullptr"); + return; + } + int32_t userId = 0; + if (!ITypesUtil::Unmarshal(*msg->msgContent_, userId)) { + IMSA_HILOGE("failed to read message"); + return; + } + IMSA_HILOGD("userId: %{public}d", userId); + auto session = UserSessionManager::GetInstance().GetUserSession(userId); + if (session == nullptr) { + UserSessionManager::GetInstance().AddUserSession(userId); + } + session = UserSessionManager::GetInstance().GetUserSession(userId); + if (session == nullptr) { + IMSA_HILOGE("%{public}d session is nullptr!", userId_); + return; + } + session->OnScreenLock(); +} + int32_t InputMethodSystemAbility::OnDisplayOptionalInputMethod() { IMSA_HILOGD("InputMethodSystemAbility::OnDisplayOptionalInputMethod start."); @@ -2287,6 +2315,10 @@ int32_t InputMethodSystemAbility::StartInputType(int32_t userId, InputType type) IMSA_HILOGI("only need input type in default display"); return ErrorCode::NO_ERROR; } + if (session->IsSimpleKeyboardEnabled() && type == InputType::CAMERA_INPUT) { + IMSA_HILOGI("current client simple keyboard enabled, not start camera input"); + return ErrorCode::NO_ERROR; + } ImeIdentification ime; int32_t ret = InputTypeManager::GetInstance().GetImeByInputType(type, ime); if (ret != ErrorCode::NO_ERROR) { diff --git a/services/src/peruser_session.cpp b/services/src/peruser_session.cpp index 8a5264bfd..a9814d025 100644 --- a/services/src/peruser_session.cpp +++ b/services/src/peruser_session.cpp @@ -842,7 +842,17 @@ void PerUserSession::StartImeInImeDied() void PerUserSession::StartImeIfInstalled() { - auto imeToStart = GetRealCurrentIme(); + auto clientGroup = GetClientGroup(ImeType::IME); + auto clientInfo = clientGroup != nullptr ? clientGroup->GetCurrentClientInfo() : nullptr; + if (!InputTypeManager::GetInstance().IsStarted() && clientInfo != nullptr + && IsPreconfiguredDefaultImeSpecified(*clientInfo)) { + StartPreconfiguredDefaultIme(DEFAULT_DISPLAY_ID); + return; + } + std::shared_ptr imeToStart = nullptr; + if (!GetInputTypeToStart(imeToStart)) { + imeToStart = ImeCfgManager::GetInstance().GetCurrentImeCfg(userId_); + } if (imeToStart == nullptr || imeToStart->imeId.empty()) { IMSA_HILOGE("imeToStart is nullptr!"); return; @@ -1018,13 +1028,8 @@ void PerUserSession::OnUnfocused(uint64_t displayId, int32_t pid, int32_t uid) void PerUserSession::OnScreenUnlock() { ImeCfgManager::GetInstance().ModifyTempScreenLockImeCfg(userId_, ""); - auto currentIme = GetRealCurrentIme(); - if (currentIme == nullptr) { - IMSA_HILOGE("currentIme nullptr"); - return; - } auto imeData = GetImeData(ImeType::IME); - if (imeData != nullptr && imeData->ime.first == currentIme->bundleName) { + if (imeData != nullptr && imeData->ime == GetImeUsedBeforeScreenLocked()) { IMSA_HILOGD("no need to switch"); return; } @@ -1036,6 +1041,15 @@ void PerUserSession::OnScreenUnlock() #endif } +void PerUserSession::OnScreenLock() +{ + auto imeData = GetImeData(ImeType::IME); + if (imeData == nullptr) { + IMSA_HILOGD("no need to switch"); + return; + } + SetImeUsedBeforeScreenLocked(imeData->ime); +} std::shared_ptr PerUserSession::GetCurrentClientInfo(uint64_t displayId) { @@ -1052,26 +1066,12 @@ bool PerUserSession::IsSameClient(sptr source, sptr return source != nullptr && dest != nullptr && source->AsObject() == dest->AsObject(); } -std::shared_ptr PerUserSession::GetRealCurrentIme(bool needSwitchToPresetImeIfNoCurIme) +int32_t PerUserSession::StartCurrentIme(bool isStopCurrentIme) { std::shared_ptr imeToStart = nullptr; - if (GetInputTypeToStart(imeToStart)) { - return imeToStart; - } - auto clientGroup = GetClientGroup(ImeType::IME); - auto clientInfo = clientGroup != nullptr ? clientGroup->GetCurrentClientInfo() : nullptr; - if (clientInfo != nullptr && IsPreconfiguredDefaultImeSpecified(*clientInfo)) { - return ImeInfoInquirer::GetInstance().GetDefaultImeCfg(); - } - if (!needSwitchToPresetImeIfNoCurIme) { - return ImeCfgManager::GetInstance().GetCurrentImeCfg(userId_); + if (!GetInputTypeToStart(imeToStart)) { + imeToStart = ImeInfoInquirer::GetInstance().GetImeToStart(userId_); } - return ImeInfoInquirer::GetInstance().GetImeToStart(userId_); -} - -int32_t PerUserSession::StartCurrentIme(bool isStopCurrentIme) -{ - auto imeToStart = GetRealCurrentIme(true); if (imeToStart == nullptr) { IMSA_HILOGE("imeToStart is nullptr!"); return ErrorCode::ERROR_IMSA_IME_TO_START_NULLPTR; @@ -2300,6 +2300,13 @@ bool PerUserSession::IsPreconfiguredDefaultImeSpecified(const InputClientInfo &i || inputClientInfo.config.isSimpleKeyboardEnabled; } +bool PerUserSession::IsSimpleKeyboardEnabled() +{ + auto clientGroup = GetClientGroup(ImeType::IME); + auto clientInfo = clientGroup != nullptr ? clientGroup->GetCurrentClientInfo() : nullptr; + return clientInfo != nullptr && clientInfo->config.isSimpleKeyboardEnabled; +} + bool PerUserSession::AllowSwitchImeByCombinationKey() { #ifdef IMF_SCREENLOCK_MGR_ENABLE @@ -2335,5 +2342,17 @@ std::pair PerUserSession::StartPreconfiguredD } return std::make_pair(ret, StartPreDefaultImeStatus::TO_START); } + +std::pair PerUserSession::GetImeUsedBeforeScreenLocked() +{ + std::lock_guard lock(imeUsedLock_); + return imeUsedBeforeScreenLocked_; +} + +void PerUserSession::SetImeUsedBeforeScreenLocked(const std::pair &ime) +{ + std::lock_guard lock(imeUsedLock_); + imeUsedBeforeScreenLocked_ = ime; +} } // namespace MiscServices } // namespace OHOS \ No newline at end of file diff --git a/test/unittest/cpp_test/src/input_method_private_member_test.cpp b/test/unittest/cpp_test/src/input_method_private_member_test.cpp index 94f3017c6..fc3e20dd5 100644 --- a/test/unittest/cpp_test/src/input_method_private_member_test.cpp +++ b/test/unittest/cpp_test/src/input_method_private_member_test.cpp @@ -1817,63 +1817,6 @@ HWTEST_F(InputMethodPrivateMemberTest, SA_CheckInputTypeOption, TestSize.Level0) EXPECT_NE(ret, ErrorCode::NO_ERROR); } -/** - * @tc.name: SA_GetRealCurrentIme - * @tc.desc: SA_GetRealCurrentIme - * @tc.type: FUNC - * @tc.require: - */ -HWTEST_F(InputMethodPrivateMemberTest, SA_GetRealCurrentIme, TestSize.Level0) -{ - IMSA_HILOGI("InputMethodPrivateMemberTest::SA_GetRealCurrentIme start."); - std::shared_ptr realPreIme = nullptr; - InputMethodController::GetInstance()->GetDefaultInputMethod(realPreIme); - ASSERT_NE(realPreIme, nullptr); - auto session = std::make_shared(MAIN_USER_ID); - // input type start - InputTypeManager::GetInstance().isStarted_ = true; - InputTypeManager::GetInstance().currentTypeIme_.bundleName = realPreIme->name; - auto ime = session->GetRealCurrentIme(); - ASSERT_NE(ime, nullptr); - EXPECT_EQ(ime->bundleName, realPreIme->name); - - // input type not start, has no current client, needSwitchToPresetImeIfNoCurIme is false - std::string bundleName1 = "bundleName1"; - std::string extName1 = "extName1"; - InputTypeManager::GetInstance().isStarted_ = false; - session->clientGroupMap_.clear(); - ImeEnabledCfg cfg; - ImeEnabledInfo enabledInfo{ bundleName1, extName1, EnabledStatus::BASIC_MODE }; - enabledInfo.extraInfo.isDefaultIme = true; - cfg.enabledInfos.push_back(enabledInfo); - ImeEnabledInfoManager::GetInstance().imeEnabledCfg_.insert_or_assign(MAIN_USER_ID, cfg); - ime = session->GetRealCurrentIme(); - ASSERT_NE(ime, nullptr); - EXPECT_EQ(ime->bundleName, bundleName1); - // has current client, pre default ime special - std::string bundleName2 = "bundleName2"; - std::string extName2 = "extName2"; - ImeInfoInquirer::GetInstance().systemConfig_.defaultInputMethod = bundleName2 + "/" + extName2; - auto group = std::make_shared(DEFAULT_DISPLAY_ID, nullptr); - sptr client = new (std::nothrow) InputClientServiceImpl(); - group->currentClient_ = client; - auto info = std::make_shared(); - info->config.isSimpleKeyboardEnabled = true; - group->mapClients_.insert_or_assign(client->AsObject(), info); - session->clientGroupMap_.insert_or_assign(DEFAULT_DISPLAY_ID, group); - ime = session->GetRealCurrentIme(); - ASSERT_NE(ime, nullptr); - EXPECT_EQ(ime->bundleName, bundleName2); - // has current client, pre default ime not special, needSwitchToPresetImeIfNoCurIme is true - ImeInfoInquirer::GetInstance().systemConfig_.defaultImeScreenList.clear(); - info->config.isSimpleKeyboardEnabled = false; - group->mapClients_.insert_or_assign(client->AsObject(), info); - session->clientGroupMap_.insert_or_assign(DEFAULT_DISPLAY_ID, group); - ime = session->GetRealCurrentIme(); - ASSERT_NE(ime, nullptr); - EXPECT_EQ(ime->bundleName, bundleName1); -} - /** * @tc.name: StartImeTryLock * @tc.desc: StartImeTryLock @@ -1889,5 +1832,88 @@ HWTEST_F(InputMethodPrivateMemberTest, StartImeTryLock001, TestSize.Level0) IMSA_HILOGI("InputMethodPrivateMemberTest::StartImeTryLock %{public}d.", tryLockFailCount_.load()); EXPECT_GT(tryLockFailCount_, 0); // at least one thread try lock failed } + +/** + * @tc.name: SA_OnScreenLock + * @tc.desc: SA_OnScreenLock + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(InputMethodPrivateMemberTest, SA_OnScreenLock, TestSize.Level0) +{ + IMSA_HILOGI("InputMethodPrivateMemberTest::SA_OnScreenLock start."); + service_->OnScreenLock(nullptr); + + MessageParcel *parcel = nullptr; + auto msg = std::make_shared(MessageID::MSG_ID_SCREEN_LOCK, parcel); + service_->OnScreenLock(msg.get()); + + int32_t userId = 1; + InputMethodPrivateMemberTest::service_->userId_ = 2; + parcel = new (std::nothrow) MessageParcel(); + ASSERT_NE(parcel, nullptr); + EXPECT_TRUE(ITypesUtil::Marshal(*parcel, userId)); + msg = std::make_shared(MessageID::MSG_ID_SCREEN_LOCK, parcel); + service_->OnScreenLock(msg.get()); + + UserSessionManager::GetInstance().userSessions_.clear(); + auto handler = UserSessionManager::GetInstance().eventHandler_; + UserSessionManager::GetInstance().eventHandler_ = nullptr; + InputMethodPrivateMemberTest::service_->userId_ = userId; + MessageParcel *parcel1 = new (std::nothrow) MessageParcel(); + ASSERT_NE(parcel1, nullptr); + EXPECT_TRUE(ITypesUtil::Marshal(*parcel1, userId)); + msg = std::make_shared(MessageID::MSG_ID_SCREEN_LOCK, parcel1); + service_->OnScreenLock(msg.get()); + UserSessionManager::GetInstance().userSessions_.clear(); + std::this_thread::sleep_for(std::chrono::seconds(1)); + UserSessionManager::GetInstance().eventHandler_ = handler; +} + +/** + * @tc.name: SA_TestPerUserSessionOnScreenlocked + * @tc.desc: SA_TestPerUserSessionOnScreenlocked. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(InputMethodPrivateMemberTest, SA_TestPerUserSessionOnScreenlocked, TestSize.Level0) +{ + IMSA_HILOGI("InputMethodPrivateMemberTest::SA_TestPerUserSessionOnScreenlocked start."); + auto userSession = std::make_shared(MAIN_USER_ID); + userSession->imeData_.clear(); + userSession->OnScreenLock(); + ImeIdentification currentIme; + InputTypeManager::GetInstance().Set(false, currentIme); + EXPECT_FALSE(InputTypeManager::GetInstance().IsStarted()); +} + +/** + * @tc.name: SA_TestPerUserSessionStartImeIfInstalled + * @tc.desc: SA_TestPerUserSessionStartImeIfInstalled. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(InputMethodPrivateMemberTest, SA_TestPerUserSessionStartImeIfInstalled, TestSize.Level0) +{ + IMSA_HILOGI("InputMethodPrivateMemberTest::SA_TestPerUserSessionStartImeIfInstalled start."); + PerUserSession session(MAIN_USER_ID); + // has current client info + auto group = std::make_shared(DEFAULT_DISPLAY_ID, nullptr); + sptr client = new (std::nothrow) InputClientServiceImpl(); + group->currentClient_ = client; + auto info = std::make_shared(); + info->config.isSimpleKeyboardEnabled = true; + group->mapClients_.insert_or_assign(client->AsObject(), info); + session.clientGroupMap_.insert_or_assign(DEFAULT_DISPLAY_ID, group); + ImeIdentification currentIme; + InputTypeManager::GetInstance().Set(false, currentIme); + EXPECT_FALSE(InputTypeManager::GetInstance().IsStarted()); + session.StartImeIfInstalled(); + + info->config.isSimpleKeyboardEnabled = false; + group->mapClients_.insert_or_assign(client->AsObject(), info); + session.clientGroupMap_.insert_or_assign(DEFAULT_DISPLAY_ID, group); + session.StartImeIfInstalled(); +} } // namespace MiscServices } // namespace OHOS \ No newline at end of file -- Gitee