diff --git a/services/dbms/src/account_manager_helper.cpp b/services/dbms/src/account_manager_helper.cpp index 6f3ddc154111bc63a1d7bc8c1a7c56677be9d4a3..7fcc6f1ffcf120eff45ca45366c9498a8e58774f 100644 --- a/services/dbms/src/account_manager_helper.cpp +++ b/services/dbms/src/account_manager_helper.cpp @@ -29,17 +29,13 @@ namespace AppExecFwk { int32_t AccountManagerHelper::GetCurrentActiveUserId() { #ifdef ACCOUNT_ENABLE - std::vector activeIds; - int ret = AccountSA::OsAccountManager::QueryActiveOsAccountIds(activeIds); + std::int32_t localId; + int32_t ret = AccountSA::OsAccountManager::GetForegroundOsAccountLocalId(localId); if (ret != 0) { - APP_LOGE("QueryActiveOsAccountIds failed ret:%{public}d", ret); + APP_LOGE("GetForegroundOsAccountLocalId failed ret:%{public}d", ret); return Constants::INVALID_USERID; } - if (activeIds.empty()) { - APP_LOGE("QueryActiveOsAccountIds activeIds empty"); - return Constants::INVALID_USERID; - } - return activeIds[0]; + return localId; #else APP_LOGI("ACCOUNT_ENABLE is false"); return Constants::INVALID_USERID;