mirror of
https://github.com/openharmony/miscservices_inputmethod.git
synced 2026-07-18 17:24:37 -04:00
@@ -87,6 +87,7 @@ namespace MiscServices {
|
||||
void OnDisplayOptionalInputMethod(int32_t userId);
|
||||
static sptr<AAFwk::IAbilityManager> GetAbilityManagerService();
|
||||
OHOS::sptr<OHOS::AppExecFwk::IBundleMgr> GetBundleMgr();
|
||||
void StartUserIdListener();
|
||||
|
||||
ServiceRunningState state_;
|
||||
void InitServiceHandler();
|
||||
|
||||
@@ -183,10 +183,21 @@ namespace MiscServices {
|
||||
userId_ = MAIN_USER_ID;
|
||||
setting->Initialize();
|
||||
|
||||
StartUserIdListener();
|
||||
}
|
||||
|
||||
void InputMethodSystemAbility::StartUserIdListener()
|
||||
{
|
||||
sptr<ImCommonEventManager> imCommonEventManager = ImCommonEventManager::GetInstance();
|
||||
if (imCommonEventManager->SubscribeEvent(EventFwk::CommonEventSupport::COMMON_EVENT_USER_SWITCHED)) {
|
||||
bool isSuccess = imCommonEventManager->SubscribeEvent(EventFwk::CommonEventSupport::COMMON_EVENT_USER_SWITCHED);
|
||||
if (isSuccess) {
|
||||
IMSA_HILOGI("InputMethodSystemAbility::Initialize subscribe service event success");
|
||||
return;
|
||||
}
|
||||
|
||||
IMSA_HILOGE("StartUserIdListener failed. Try again 10s later");
|
||||
auto callback = [this]() { StartUserIdListener(); };
|
||||
serviceHandler_->PostTask(callback, INIT_INTERVAL);
|
||||
}
|
||||
|
||||
void InputMethodSystemAbility::StartInputService(std::string imeId)
|
||||
|
||||
Reference in New Issue
Block a user