回退 'Pull Request !2094 : 创建帐号等待过程不进行时间监控'

This commit is contained in:
oh_ci 2024-09-13 09:01:22 +00:00 committed by Gitee
parent 582dd67c16
commit 31ae338f94
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 13 additions and 75 deletions

View File

@ -45,7 +45,6 @@ ohos_shared_library("libaccount_common") {
"file_operator/src/account_file_operator.cpp",
"log/src/account_log_wrapper.cpp",
"perf_stat/src/perf_stat.cpp",
"utils/src/account_constants.cpp",
"utils/src/account_permission_manager.cpp",
"utils/src/memory_guard.cpp",
]
@ -86,11 +85,6 @@ ohos_shared_library("libaccount_common") {
cflags += [ "-DWITH_SELINUX" ]
}
if (hicollie_enable == true) {
external_deps += [ "hicollie:libhicollie" ]
cflags_cc += [ "-DHICOLLIE_ENABLE" ]
}
subsystem_name = "account"
innerapi_tags = [ "platformsdk" ]
part_name = "os_account"

View File

@ -15,7 +15,6 @@
#ifndef OS_ACCOUNT_FRAMEWORKS_ACCOUNT_CONSTANTS_H
#define OS_ACCOUNT_FRAMEWORKS_ACCOUNT_CONSTANTS_H
#include <stdint.h>
#define TOKEN_ID_LOWMASK 0xffffffff
namespace OHOS {
@ -26,15 +25,6 @@ const uint32_t TIMEOUT = 30; // 30s
constexpr const char TIMER_NAME[] = "AccountMgrTimer";
#endif // HICOLLIE_ENABLE
class AccountTimer {
public:
AccountTimer(bool needInit = true);
~AccountTimer();
void Init();
private:
int64_t timerId_ = -1;
};
} // namespace AccountSA
} // namespace OHOS
#endif // OS_ACCOUNT_FRAMEWORKS_ACCOUNT_CONSTANTS_H

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "account_constants.h"
#ifdef HICOLLIE_ENABLE
#include "xcollie/xcollie.h"
#endif // HICOLLIE_ENABLE
namespace OHOS {
namespace AccountSA {
AccountTimer::AccountTimer(bool needInit)
{
if (needInit) {
Init();
}
}
AccountTimer::~AccountTimer()
{
#ifdef HICOLLIE_ENABLE
HiviewDFX::XCollie::GetInstance().CancelTimer(timerId_);
#endif // HICOLLIE_ENABLE
}
void AccountTimer::Init()
{
#ifdef HICOLLIE_ENABLE
timerId_ = HiviewDFX::XCollie::GetInstance().SetTimer(
TIMER_NAME, TIMEOUT, nullptr, nullptr, HiviewDFX::XCOLLIE_FLAG_LOG);
#endif // HICOLLIE_ENABLE
}
} // namespace AccountSA
} // namespace OHOS

View File

@ -419,7 +419,6 @@ ErrCode IInnerOsAccountManager::CreateOsAccount(
ACCOUNT_LOGI("Not allow creation account.");
return ERR_OSACCOUNT_SERVICE_INNER_ACCOUNT_PLUGIN_NOT_ALLOWED_CREATION_ERROR;
}
AccountTimer timer;
unsigned int osAccountNum = 0;
GetCreatedOsAccountsCount(osAccountNum);
if (!AccountPermissionManager::CheckSaCall() && osAccountNum >= config_.maxOsAccountNum) {
@ -447,7 +446,6 @@ ErrCode IInnerOsAccountManager::CreateOsAccount(const std::string &localName, co
ACCOUNT_LOGI("Not allow creation account.");
return ERR_OSACCOUNT_SERVICE_INNER_ACCOUNT_PLUGIN_NOT_ALLOWED_CREATION_ERROR;
}
AccountTimer timer;
osAccountInfo.SetLocalName(localName);
#ifdef ENABLE_ACCOUNT_SHORT_NAME
OsAccountInfo accountInfoOld;
@ -515,7 +513,6 @@ ErrCode IInnerOsAccountManager::CreateOsAccountWithFullInfo(OsAccountInfo &osAcc
ACCOUNT_LOGI("Not allow creation account.");
return ERR_OSACCOUNT_SERVICE_INNER_ACCOUNT_PLUGIN_NOT_ALLOWED_CREATION_ERROR;
}
AccountTimer timer;
if (!CheckAndAddLocalIdOperating(osAccountInfo.GetLocalId())) {
ACCOUNT_LOGW("Account id = %{public}d already in operating", osAccountInfo.GetLocalId());
return ERR_OSACCOUNT_SERVICE_INNER_ACCOUNT_OPERATING_ERROR;
@ -655,7 +652,6 @@ ErrCode IInnerOsAccountManager::CreateOsAccountForDomain(
ACCOUNT_LOGI("Not allow creation account.");
return ERR_OSACCOUNT_SERVICE_INNER_ACCOUNT_PLUGIN_NOT_ALLOWED_CREATION_ERROR;
}
AccountTimer timer;
std::vector<OsAccountInfo> osAccountInfos;
(void)QueryAllCreatedOsAccounts(osAccountInfos);
if (CheckDomainAccountBound(osAccountInfos, domainInfo)) {

View File

@ -29,12 +29,6 @@ namespace AccountSA {
#ifdef HICOLLIE_ENABLE
constexpr std::int32_t RECOVERY_TIMEOUT = 6; // timeout 6s
#endif // HICOLLIE_ENABLE
const std::set<uint32_t> WATCH_DOG_WHITE_LIST = {
static_cast<uint32_t>(OsAccountInterfaceCode::CREATE_OS_ACCOUNT),
static_cast<uint32_t>(OsAccountInterfaceCode::CREATE_OS_ACCOUNT_WITH_SHORT_NAME),
static_cast<uint32_t>(OsAccountInterfaceCode::CREATE_OS_ACCOUNT_WITH_FULL_INFO),
static_cast<uint32_t>(OsAccountInterfaceCode::CREATE_OS_ACCOUNT_FOR_DOMAIN),
};
const std::map<uint32_t, OsAccountStub::OsAccountMessageProc> messageProcMap = {
{
static_cast<uint32_t>(OsAccountInterfaceCode::CREATE_OS_ACCOUNT),
@ -511,10 +505,10 @@ int OsAccountStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessagePa
return ERR_ACCOUNT_COMMON_CHECK_DESCRIPTOR_ERROR;
}
AccountTimer timer(false);
if (WATCH_DOG_WHITE_LIST.find(code) == WATCH_DOG_WHITE_LIST.end()) {
timer.Init();
}
#ifdef HICOLLIE_ENABLE
int timerId =
HiviewDFX::XCollie::GetInstance().SetTimer(TIMER_NAME, TIMEOUT, nullptr, nullptr, HiviewDFX::XCOLLIE_FLAG_LOG);
#endif // HICOLLIE_ENABLE
auto messageProc = messageProcMap_.find(code);
if (messageProc != messageProcMap_.end()) {
@ -523,12 +517,21 @@ int OsAccountStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessagePa
ErrCode result = AccountPermissionManager::CheckSystemApp();
if (result != ERR_OK) {
ACCOUNT_LOGE("is not system application, result = %{public}u.", result);
#ifdef HICOLLIE_ENABLE
HiviewDFX::XCollie::GetInstance().CancelTimer(timerId);
#endif // HICOLLIE_ENABLE
return result;
}
}
int ret = (messageProcFunction.messageProcFunction)(this, data, reply);
#ifdef HICOLLIE_ENABLE
HiviewDFX::XCollie::GetInstance().CancelTimer(timerId);
#endif // HICOLLIE_ENABLE
return ret;
}
#ifdef HICOLLIE_ENABLE
HiviewDFX::XCollie::GetInstance().CancelTimer(timerId);
#endif // HICOLLIE_ENABLE
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
}