From 89a4b70c4750ee93e379ebd9f84b4a89c928bfb5 Mon Sep 17 00:00:00 2001 From: GlaryCastle Date: Tue, 12 Jul 2022 15:30:50 +0800 Subject: [PATCH] Signed-off-by: GlaryCastle Changes to be committed: modified: services/src/input_method_system_ability.cpp --- services/src/input_method_system_ability.cpp | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/services/src/input_method_system_ability.cpp b/services/src/input_method_system_ability.cpp index 6c29835..67778c0 100644 --- a/services/src/input_method_system_ability.cpp +++ b/services/src/input_method_system_ability.cpp @@ -19,6 +19,7 @@ #include "system_ability_definition.h" #include "iservice_registry.h" #include "ipc_skeleton.h" +#include "errors.h" #include "global.h" #include "ui_service_mgr_client.h" #include "bundle_mgr_proxy.h" @@ -170,23 +171,22 @@ namespace MiscServices { IMSA_HILOGI("InputMethodSystemAbility::DumpAllMethod"); std::vector ids; int errCode = OsAccountManager::QueryActiveOsAccountIds(ids); - if (errCode == 0) { - dprintf(fd, "\n - DumpAllMethod get Active Id succeed,count=%d,", ids.size()); - for (auto it : ids) { - int32_t userId = getUserId(it); - std::vector properties; - listInputMethodByUserId(userId, &properties); - if (properties.empty()) { - IMSA_HILOGI("The IME properties is empty."); - dprintf(fd, "\n - The IME properties is empty.\n"); - return; - } - std::string params; - GetInputMethodParam(properties, params); - dprintf(fd, "\n - The userId %d get input method:\n%s\n", userId, params.c_str()); - } - } else { + if (errCode != ERR_OK) { dprintf(fd, "\n - InputMethodSystemAbility::DumpAllMethod get Active Id failed.\n"); + return; + } + dprintf(fd, "\n - DumpAllMethod get Active Id succeed,count=%d,", ids.size()); + for (auto it : ids) { + std::vector properties; + listInputMethodByUserId(it, &properties); + if (properties.empty()) { + IMSA_HILOGI("The IME properties is empty."); + dprintf(fd, "\n - The IME properties is empty.\n"); + continue; + } + std::string params; + GetInputMethodParam(properties, params); + dprintf(fd, "\n - The Active Id:%d get input method:\n%s\n", it, params.c_str()); } IMSA_HILOGI("InputMethodSystemAbility::DumpAllMethod end."); }