From e96aa992a05476ee4e58cd8b6eef21fd01a80b22 Mon Sep 17 00:00:00 2001 From: lichenchen Date: Thu, 15 Sep 2022 15:35:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E8=B4=A6=E5=8F=B7hidumper?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E8=B4=A6=E5=8F=B7=E4=BF=A1=E6=81=AF=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E9=97=AE=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lichenchen --- dfx/hidumper_adapter/account_dump_helper.cpp | 2 +- .../include/osaccount/os_account_manager_service.h | 1 + .../src/osaccount/os_account_manager_service.cpp | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/dfx/hidumper_adapter/account_dump_helper.cpp b/dfx/hidumper_adapter/account_dump_helper.cpp index 9d842f6d8..c1f5b787b 100644 --- a/dfx/hidumper_adapter/account_dump_helper.cpp +++ b/dfx/hidumper_adapter/account_dump_helper.cpp @@ -159,7 +159,7 @@ void AccountDumpHelper::ShowOsAccountInfo(std::string& result) const } std::vector states; - ErrCode ret = osAccountMgrService_->DumpState(-1, states); // -1 means query all + ErrCode ret = osAccountMgrService_->DumpOsAccountInfo(states); if (ret != ERR_OK) { result.append("Cannot query os account list, error code "); result.append(std::to_string(ret)); diff --git a/services/accountmgr/include/osaccount/os_account_manager_service.h b/services/accountmgr/include/osaccount/os_account_manager_service.h index 1d92e9d36..c177fba1d 100644 --- a/services/accountmgr/include/osaccount/os_account_manager_service.h +++ b/services/accountmgr/include/osaccount/os_account_manager_service.h @@ -83,6 +83,7 @@ public: ErrCode SetCurrentOsAccountIsVerified(const bool isVerified) override; ErrCode SetOsAccountIsVerified(const int id, const bool isVerified) override; ErrCode DumpState(const int &id, std::vector &state) override; + ErrCode DumpOsAccountInfo(std::vector &state); void CreateBasicAccounts() override; ErrCode GetCreatedOsAccountNumFromDatabase(const std::string& storeID, diff --git a/services/accountmgr/src/osaccount/os_account_manager_service.cpp b/services/accountmgr/src/osaccount/os_account_manager_service.cpp index cee8d40a0..5c1bc7714 100644 --- a/services/accountmgr/src/osaccount/os_account_manager_service.cpp +++ b/services/accountmgr/src/osaccount/os_account_manager_service.cpp @@ -524,6 +524,20 @@ ErrCode OsAccountManagerService::DumpState(const int &id, std::vector &state) +{ + state.clear(); + + ErrCode result = ERR_OK; + std::vector osAccountInfos; + result = innerManager_->QueryAllCreatedOsAccounts(osAccountInfos); + if (result != ERR_OK) { + return result; + } + + return DumpStateByAccounts(osAccountInfos, state); +} + ErrCode OsAccountManagerService::GetCreatedOsAccountNumFromDatabase(const std::string& storeID, int &createdOsAccountNum) {