mirror of
https://gitee.com/openharmony/inputmethod_imf
synced 2024-11-23 06:40:06 +00:00
commit
fa0218daf5
@ -193,6 +193,7 @@ using namespace MessageID;
|
||||
void InputMethodController::Attach(sptr<OnTextChangedListener> &listener)
|
||||
{
|
||||
textListener = listener;
|
||||
PrepareInput(0, mClient, mInputDataChannel, mAttribute);
|
||||
StartInput(mClient);
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user