Lines Matching refs:userId
79 bool ImeInfoInquirer::QueryImeExtInfos(const int32_t userId, std::vector<ExtensionAbilityInfo> &infos)
81 IMSA_HILOGD("userId: %{public}d.", userId);
87 if (!bundleMgr->QueryExtensionAbilityInfos(ExtensionAbilityType::INPUTMETHOD, userId, infos)) {
94 int32_t ImeInfoInquirer::GetExtInfosByBundleName(const int32_t userId, const std::string &bundleName,
97 IMSA_HILOGD("userId: %{public}d, bundleName: %{public}s.", userId, bundleName.c_str());
99 if (!QueryImeExtInfos(userId, tempExtInfos)) {
115 std::shared_ptr<ImeInfo> ImeInfoInquirer::GetImeInfo(int32_t userId, const std::string &bundleName,
118 IMSA_HILOGD("userId: %{public}d, bundleName: %{public}s, subName: %{public}s.", userId, bundleName.c_str(),
120 auto info = GetImeInfoFromCache(userId, bundleName, subName);
121 return info == nullptr ? GetImeInfoFromBundleMgr(userId, bundleName, subName) : info;
124 std::shared_ptr<ImeInfo> ImeInfoInquirer::GetImeInfoFromCache(const int32_t userId, const std::string &bundleName,
127 auto fullInfo = FullImeInfoManager::GetInstance().Get(userId);
158 const int32_t userId, const std::string &bundleName, const std::string &subName)
160 IMSA_HILOGD("userId: %{public}d, bundleName: %{public}s, subName: %{public}s.", userId, bundleName.c_str(),
163 auto ret = ImeInfoInquirer::GetInstance().GetExtInfosByBundleName(userId, bundleName, extInfos);
165 IMSA_HILOGE("userId: %{public}d getExtInfosByBundleName %{public}s failed!", userId, bundleName.c_str());
171 info->prop.label = GetTargetString(extInfos[0], ImeTargetString::LABEL, userId);
177 ret = info->isNewIme ? ListInputMethodSubtype(userId, extInfos[0], subProps)
178 : ListInputMethodSubtype(userId, extInfos, subProps);
180 IMSA_HILOGE("userId: %{public}d listInputMethodSubtype failed!", userId);
203 std::string ImeInfoInquirer::GetDumpInfo(int32_t userId)
205 auto properties = ListInputMethodInfo(userId);
209 auto currentImeCfg = ImeCfgManager::GetInstance().GetCurrentImeCfg(userId);
229 std::vector<InputMethodInfo> ImeInfoInquirer::ListInputMethodInfo(const int32_t userId)
231 IMSA_HILOGD("userId: %{public}d.", userId);
233 if (!QueryImeExtInfos(userId, extensionInfos)) {
234 IMSA_HILOGE("userId: %{public}d queryImeExtInfos failed!", userId);
240 auto label = GetTargetString(extension, ImeTargetString::LABEL, userId);
241 auto description = GetTargetString(extension, ImeTargetString::DESCRIPTION, userId);
254 int32_t ImeInfoInquirer::ListInputMethod(int32_t userId, InputMethodStatus status, std::vector<Property> &props,
257 IMSA_HILOGD("userId: %{public}d, status: %{public}d.", userId, status);
259 return ListInputMethod(userId, props);
262 return ListEnabledInputMethod(userId, props, enableOn);
265 return ListDisabledInputMethod(userId, props, enableOn);
270 int32_t ImeInfoInquirer::ListInputMethod(const int32_t userId, std::vector<Property> &props)
272 IMSA_HILOGD("userId: %{public}d.", userId);
273 auto infos = FullImeInfoManager::GetInstance().Get(userId);
281 IMSA_HILOGD("%{public}d get all prop form bms.", userId);
283 if (!QueryImeExtInfos(userId, extensionInfos)) {
298 .label = GetTargetString(extension, ImeTargetString::LABEL, userId),
305 int32_t ImeInfoInquirer::ListEnabledInputMethod(const int32_t userId, std::vector<Property> &props, bool enableOn)
307 IMSA_HILOGD("userId: %{public}d.", userId);
308 int32_t ret = ListInputMethod(userId, props);
310 IMSA_HILOGE("userId: %{public}d listInputMethod failed!", userId);
316 ret = EnableImeDataParser::GetInstance()->GetEnableIme(userId, enableVec);
332 int32_t ImeInfoInquirer::ListDisabledInputMethod(const int32_t userId, std::vector<Property> &props, bool enableOn)
334 IMSA_HILOGD("userId: %{public}d.", userId);
340 auto ret = ListInputMethod(userId, props);
342 IMSA_HILOGE("userId: %{public}d listInputMethod failed!", userId);
347 ret = EnableImeDataParser::GetInstance()->GetEnableIme(userId, enableVec);
362 int32_t ImeInfoInquirer::GetSwitchInfoBySwitchCount(SwitchInfo &switchInfo, int32_t userId, bool enableOn,
366 auto ret = ListEnabledInputMethod(userId, props, enableOn);
368 IMSA_HILOGE("userId: %{public}d ListEnabledInputMethod failed!", userId);
371 auto currentImeBundle = ImeCfgManager::GetInstance().GetCurrentImeCfg(userId)->bundleName;
376 auto info = GetDefaultImeInfo(userId);
390 int32_t ImeInfoInquirer::ListInputMethodSubtype(int32_t userId, const std::string &bundleName,
393 IMSA_HILOGD("userId: %{public}d, bundleName: %{public}s.", userId, bundleName.c_str());
394 auto infos = FullImeInfoManager::GetInstance().Get(userId);
402 IMSA_HILOGD("%{public}d get %{public}s all subProp form bms.", userId, bundleName.c_str());
404 auto ret = GetExtInfosByBundleName(userId, bundleName, extInfos);
406 IMSA_HILOGE("userId: %{public}d getExtInfosByBundleName %{public}s failed!", userId, bundleName.c_str());
409 return IsNewExtInfos(extInfos) ? ListInputMethodSubtype(userId, extInfos[0], subProps)
410 : ListInputMethodSubtype(userId, extInfos, subProps);
413 int32_t ImeInfoInquirer::ListCurrentInputMethodSubtype(int32_t userId, std::vector<SubProperty> &subProps)
415 auto currentImeCfg = ImeCfgManager::GetInstance().GetCurrentImeCfg(userId);
417 return ListInputMethodSubtype(userId, currentImeCfg->bundleName, subProps);
431 int32_t ImeInfoInquirer::GetSubProperty(int32_t userId, const std::string &subName,
434 IMSA_HILOGD("oldIme, userId: %{public}d.", userId);
446 subProp.label = GetStringById(extInfo->bundleName, extInfo->moduleName, extInfo->labelId, userId);
459 int32_t ImeInfoInquirer::ListInputMethodSubtype(const int32_t userId,
462 IMSA_HILOGD("oldIme, userId: %{public}d.", userId);
466 subProperty.label = GetStringById(extInfo.bundleName, extInfo.moduleName, extInfo.labelId, userId);
481 int32_t ImeInfoInquirer::GetSubProperty(int32_t userId, const std::string &subName,
484 IMSA_HILOGD("newIme, userId: %{public}d.", userId);
512 subProp.label = GetStringById(extInfo.bundleName, extInfo.moduleName, subProp.labelId, userId);
526 int32_t ImeInfoInquirer::ListInputMethodSubtype(const int32_t userId, const ExtensionAbilityInfo &extInfo,
529 IMSA_HILOGD("newIme, userId: %{public}d.", userId);
628 uint32_t labelId, int32_t userId)
631 return bundleMgr == nullptr ? "" : bundleMgr->GetStringById(bundleName, moduleName, labelId, userId);
658 int32_t userId, const std::string &bundleName, const std::string &extName)
662 auto ret = ImeInfoInquirer::GetInstance().GetExtInfosByBundleName(userId, bundleName, extInfos);
664 IMSA_HILOGE("userId: %{public}d getExtInfosByBundleName %{public}s failed!", userId, bundleName.c_str());
669 .label = GetTargetString(extInfos[0], ImeTargetString::LABEL, userId),
675 std::shared_ptr<Property> ImeInfoInquirer::GetCurrentInputMethod(int32_t userId)
677 auto currentImeCfg = ImeCfgManager::GetInstance().GetCurrentImeCfg(userId);
679 auto infos = FullImeInfoManager::GetInstance().Get(userId);
688 IMSA_HILOGD("%{public}d get %{public}s prop form bms.", userId, currentImeCfg->bundleName.c_str());
689 return GetImeProperty(userId, currentImeCfg->bundleName, currentImeCfg->extName);
692 std::shared_ptr<SubProperty> ImeInfoInquirer::GetCurrentSubtype(int32_t userId)
694 auto currentIme = ImeCfgManager::GetInstance().GetCurrentImeCfg(userId);
696 auto infos = FullImeInfoManager::GetInstance().Get(userId);
706 ImeCfgManager::GetInstance().ModifyImeCfg({ userId, currentIme->imeId, it->subProps[0].id, false });
710 IMSA_HILOGD("%{public}d get [%{public}s, %{public}s] form bms.", userId, currentIme->bundleName.c_str(),
713 auto ret = GetExtInfosByBundleName(userId, currentIme->bundleName, extInfos);
720 ret = IsNewExtInfos(extInfos) ? GetSubProperty(userId, currentIme->subName, extInfos[0], subProp)
721 : GetSubProperty(userId, currentIme->subName, extInfos, subProp);
729 bool ImeInfoInquirer::IsImeInstalled(const int32_t userId, const std::string &bundleName, const std::string &extName)
731 IMSA_HILOGD("userId: %{public}d, bundleName: %{public}s, extName: %{public}s.", userId, bundleName.c_str(),
734 GetExtInfosByBundleName(userId, bundleName, extInfos);
747 std::shared_ptr<ImeNativeCfg> ImeInfoInquirer::GetImeToStart(int32_t userId)
749 auto currentImeCfg = ImeCfgManager::GetInstance().GetCurrentImeCfg(userId);
750 IMSA_HILOGD("userId: %{public}d, currentIme: %{public}s.", userId, currentImeCfg->imeId.c_str());
751 if (currentImeCfg->imeId.empty() || !IsImeInstalled(userId, currentImeCfg->bundleName, currentImeCfg->extName)) {
753 auto info = GetDefaultImeInfo(userId);
761 ? ImeCfgManager::GetInstance().AddImeCfg({ userId, newIme.imeId, newIme.subName, false })
762 : ImeCfgManager::GetInstance().ModifyImeCfg({ userId, newIme.imeId, newIme.subName, false});
768 int32_t ImeInfoInquirer::GetInputMethodConfig(const int32_t userId, AppExecFwk::ElementName &inputMethodConfig)
770 IMSA_HILOGD("userId: %{public}d.", userId);
794 int32_t ImeInfoInquirer::GetDefaultInputMethod(const int32_t userId, std::shared_ptr<Property> &prop, bool isBrief)
796 IMSA_HILOGD("userId: %{public}d.", userId);
802 auto infos = FullImeInfoManager::GetInstance().Get(userId);
811 IMSA_HILOGD("%{public}d get %{public}s form bms.", userId, defaultIme->name.c_str());
821 prop = GetImeProperty(userId, defaultIme->name, defaultIme->id);
825 std::shared_ptr<ImeInfo> ImeInfoInquirer::GetDefaultImeInfo(int32_t userId)
832 auto info = GetImeInfo(userId, defaultIme->name, "");
834 IMSA_HILOGE("userId: %{public}d, bundleName: %{public}s getImeInfoFromBundleMgr failed!", userId,
973 for (auto &userId : userIds) {
975 auto errNo = QueryFullImeInfo(userId, infos);
979 fullImeInfos.emplace_back(userId, infos);
987 int32_t ImeInfoInquirer::QueryFullImeInfo(int32_t userId, std::vector<FullImeInfo> &imeInfo)
990 auto ret = ImeInfoInquirer::GetInstance().QueryImeExtInfos(userId, extInfos);
992 IMSA_HILOGE("%{public}d QueryImeExtInfos failed!", userId);
1010 auto errNo = GetFullImeInfo(userId, extInfo.second, info);
1019 int32_t ImeInfoInquirer::GetFullImeInfo(int32_t userId, const std::string &bundleName, FullImeInfo &imeInfo)
1022 auto ret = ImeInfoInquirer::GetInstance().QueryImeExtInfos(userId, extInfos);
1035 return GetFullImeInfo(userId, tempExtInfos, imeInfo);
1039 int32_t userId, const std::vector<OHOS::AppExecFwk::ExtensionAbilityInfo> &extInfos, FullImeInfo &imeInfo)
1045 auto ret = imeInfo.isNewIme ? ListInputMethodSubtype(userId, extInfos[0], imeInfo.subProps)
1046 : ListInputMethodSubtype(userId, extInfos, imeInfo.subProps);
1048 IMSA_HILOGE("[%{public}d,%{public}s] list Subtype failed!", userId, extInfos[0].bundleName.c_str());
1054 imeInfo.prop.label = GetTargetString(extInfos[0], ImeTargetString::LABEL, userId);
1058 if (GetBundleInfoByBundleName(userId, imeInfo.prop.name, bundleInfo)) {
1065 bool ImeInfoInquirer::IsInputMethod(int32_t userId, const std::string &bundleName)
1072 auto ret = bmg->GetBundleInfo(bundleName, BundleFlag::GET_BUNDLE_WITH_EXTENSION_INFO, bundleInfo, userId);
1093 std::vector<std::string> ImeInfoInquirer::GetRunningIme(int32_t userId)
1098 auto ret = client.GetProcessRunningInfosByUserId(infos, userId);
1111 bool ImeInfoInquirer::IsDefaultImeSet(int32_t userId)
1113 return ImeCfgManager::GetInstance().IsDefaultImeSet(userId);
1116 bool ImeInfoInquirer::IsRunningIme(int32_t userId, const std::string &bundleName)
1118 auto bundleNames = GetRunningIme(userId);
1124 bool ImeInfoInquirer::GetImeAppId(int32_t userId, const std::string &bundleName, std::string &appId)
1127 if (FullImeInfoManager::GetInstance().Get(bundleName, userId, imeInfo) && !imeInfo.appId.empty()) {
1132 if (!GetBundleInfoByBundleName(userId, bundleName, bundleInfo)) {
1139 bool ImeInfoInquirer::GetImeVersionCode(int32_t userId, const std::string &bundleName, uint32_t &versionCode)
1142 if (FullImeInfoManager::GetInstance().Get(bundleName, userId, imeInfo)) {
1147 if (!GetBundleInfoByBundleName(userId, bundleName, bundleInfo)) {
1155 int32_t userId, const std::string &bundleName, AppExecFwk::BundleInfo &bundleInfo)
1163 bundleName, static_cast<int32_t>(GetBundleInfoFlag::GET_BUNDLE_INFO_WITH_SIGNATURE_INFO), bundleInfo, userId);
1172 const AppExecFwk::ExtensionAbilityInfo &extension, ImeTargetString target, int32_t userId)
1176 return GetStringById(extension.bundleName, extension.moduleName, extension.labelId, userId);
1180 extension.applicationInfo.labelResource.id, userId);
1184 return GetStringById(extension.bundleName, extension.moduleName, extension.descriptionId, userId);
1188 extension.applicationInfo.descriptionResource.id, userId);