/*
* Copyright (c) 2021-2023 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 <cerrno>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <thread>
#include <unistd.h>
#include "access_token.h"
#include "accesstoken_kit.h"
#include "account_info.h"
#include "account_log_wrapper.h"
#include "account_proxy.h"
#ifdef HAS_CES_PART
#include "common_event_manager.h"
#include "common_event_subscriber.h"
#include "common_event_support.h"
#include "common_event_subscribe_info.h"
#include "matching_skills.h"
#endif // HAS_CES_PART
#include "if_system_ability_manager.h"
#include "ipc_skeleton.h"
#include "iservice_registry.h"
#include "os_account_manager.h"
#define private public
#include "account_file_operator.h"
#undef private
#include "os_account_constants.h"
#ifdef BUNDLE_ADAPTER_MOCK
#define private public
#include "os_account.h"
#include "os_account_manager_service.h"
#include "os_account_proxy.h"
#include "iinner_os_account_manager.h"
#undef private
#endif
#include "parameter.h"
#include "system_ability.h"
#include "system_ability_definition.h"
#include "token_setproc.h"
using namespace testing;
using namespace testing::ext;
using namespace OHOS;
using namespace OHOS::AccountSA;
using namespace OHOS::Security::AccessToken;
uint64_t g_selfTokenID;
namespace {
const std::string STRING_EMPTY = "";
const std::string STRING_NAME = "name";
const std::string STRING_TEST_NAME = "test_account_name";
const std::string STRING_TEST_NAME_TWO = "test_account_name_2";
const std::uint32_t INVALID_TOKEN_ID = 0;
#ifdef DOMAIN_ACCOUNT_TEST_CASE
const std::uint32_t INVALID_BUNDLE_ID = -1;
#endif
const std::int32_t ERROR_LOCAL_ID = -1;
const std::int32_t LOCAL_ID = 105;
const std::int32_t WAIT_FOR_EXIT = 1000;
const std::int64_t INVALID_SERIAL_NUM = 123;
const std::int32_t WAIT_A_MOMENT = 3000;
const std::int32_t MAIN_ACCOUNT_ID = 100;
const std::int32_t INVALID_ID = 200;
const std::uint32_t MAX_WAIT_FOR_READY_CNT = 10;
const std::int32_t DEFAULT_API_VERSION = 8;
const uid_t ACCOUNT_UID = 3058;
const gid_t ACCOUNT_GID = 3058;
const std::vector<std::string> CONSTANTS_VECTOR {
"constraint.print",
"constraint.screen.timeout.set",
"constraint.share.into.profile"
};
const std::vector<std::string> CONSTANTS_VECTOR_TEST {
"constraint.private.dns.set",
};
const std::string CONSTRAINT_PRIVATE_DNS_SET = "constraint.private.dns.set";
const std::string CONSTANT_WIFI = "constraint.wifi";
const std::string CONSTANT_PRINT = "constraint.print";
const std::string STRING_NAME_OUT_OF_RANGE(1200, '1'); // length 1200
const std::string STRING_PHOTO_OUT_OF_RANGE(5524, '1'); // length 5524
const std::string PHOTO_IMG =
"data:image/"
"png;base64,"
"iVBORw0KGgoAAAANSUhEUgAAABUAAAAXCAIAAABrvZPKAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAEXRFWHRTb2Z0d2FyZQBTbmlwYXN0ZV0Xzt0AAA"
"FBSURBVDiN7ZQ/S8NQFMVPxU/QCx06GBzrkqUZ42rBbHWUBDqYxSnUoTxXydCSycVsgltfBiFDR8HNdHGxY4nQQAPvMzwHsWn+KMWsPdN7h/"
"vj3He5vIaUEjV0UAfe85X83KMBT7N75JEXVdSlfEAVfPRyZ5yfIrBoUkVlMU82Hkp8wu9ddt1vFew4sIiIiKwgzcXIvN7GTZOvpZRrbja3tDG/"
"D3I1NZvmdCXz+XOv5wJANKHOVYjRTAghxIyh0FHKb+0QQH5+kXf2zkYGAG0oFr5RfnK8DAGkwY19wliRT2L448vjv0YGQFVa8VKdDXUU+"
"faFUxpblhxYRNRzmd6FNnS0H3/X/VH6j0IIIRxMLJ5k/j/2L/"
"zchW8pKj7iFAA0R2wajl5d46idlR3+GtPV2XOvQ3bBNvyFs8U39v9PLX0Bp0CN+yY0OAEAAAAASUVORK5CYII=";
const std::string PHOTO_IMG_ERROR =
"iVBORw0KGgoAAAANSUhEUgAAABUAAAAXCAIAAABrvZPKAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAEXRFWHRTb2Z0d2FyZQBTbmlwYXN0ZV0Xzt0AAA"
"FBSURBVDiN7ZQ/S8NQFMVPxU/QCx06GBzrkqUZ42rBbHWUBDqYxSnUoTxXydCSycVsgltfBiFDR8HNdHGxY4nQQAPvMzwHsWn+KMWsPdN7h/"
"vj3He5vIaUEjV0UAfe85X83KMBT7N75JEXVdSlfEAVfPRyZ5yfIrBoUkVlMU82Hkp8wu9ddt1vFew4sIiIiKwgzcXIvN7GTZOvpZRrbja3tDG/"
"D3I1NZvmdCXz+XOv5wJANKHOVYjRTAghxIyh0FHKb+0QQH5+kXf2zkYGAG0oFr5RfnK8DAGkwY19wliRT2L448vjv0YGQFVa8VKdDXUU+"
"faFUxpblhxYRNRzmd6FNnS0H3/X/VH6j0IIIRxMLJ5k/j/2L/"
"zchW8pKj7iFAA0R2wajl5d46idlR3+GtPV2XOvQ3bBNvyFs8U39v9PLX0Bp0CN+yY0OAEAAAAASUVORK5CYII=";
const std::string STRING_DOMAIN_NAME_OUT_OF_RANGE(200, '1'); // length 200
const std::string STRING_DOMAIN_ACCOUNT_NAME_OUT_OF_RANGE(600, '1'); // length 600
const std::string STRING_DOMAIN_VALID = "TestDomainMT";
const std::string STRING_DOMAIN_ACCOUNT_NAME_VALID = "TestDomainAccountNameMT";
const std::string TEST_ACCOUNT_NAME = "TestAccountNameOS";
const std::string TEST_ACCOUNT_UID = "123456789os";
const std::string TEST_EXPECTED_UID = "4E7FA9CA2E8760692F2ADBA7AE59B37E02E650670E5FA5F3D01232DCD52D3893";
std::shared_ptr<AccountFileOperator> g_accountFileOperator = std::make_shared<AccountFileOperator>();
static PermissionDef INFO_MANAGER_TEST_PERM_DEF1 = {
.permissionName = "open the door",
.bundleName = "osaccount_test",
.grantMode = 1,
.availableLevel = APL_NORMAL,
.provisionEnable = false,
.distributedSceneEnable = false,
.label = "label",
.labelId = 1,
.description = "open the door",
.descriptionId = 1
};
static PermissionDef INFO_MANAGER_TEST_PERM_DEF2 = {
.permissionName = "break the door",
.bundleName = "osaccount_test",
.grantMode = 1,
.availableLevel = APL_NORMAL,
.provisionEnable = false,
.distributedSceneEnable = false,
.label = "label",
.labelId = 1,
.description = "break the door",
.descriptionId = 1
};
static PermissionStateFull INFO_MANAGER_TEST_STATE1 = {
.permissionName = "open the door",
.isGeneral = true,
.resDeviceID = {"local"},
.grantStatus = {1},
.grantFlags = {1}
};
static PermissionStateFull INFO_MANAGER_TEST_STATE2 = {
.permissionName = "break the door",
.isGeneral = false,
.resDeviceID = {"device 1", "device 2"},
.grantStatus = {1, 3},
.grantFlags = {1, 2}
};
static HapPolicyParams INFO_MANAGER_TEST_POLICY_PRAMS = {
.apl = APL_NORMAL,
.domain = "test.domain",
.permList = {INFO_MANAGER_TEST_PERM_DEF1, INFO_MANAGER_TEST_PERM_DEF2},
.permStateList = {INFO_MANAGER_TEST_STATE1, INFO_MANAGER_TEST_STATE2}
};
HapInfoParams infoManagerTestNormalInfoParms = {
.userID = 1,
.bundleName = "osaccount_test",
.instIndex = 0,
.appIDDesc = "testtesttesttest",
.apiVersion = DEFAULT_API_VERSION,
.isSystemApp = false
};
HapInfoParams infoManagerTestSystemInfoParms = {
.userID = 1,
.bundleName = "osaccount_test",
.instIndex = 0,
.appIDDesc = "testtesttesttest",
.apiVersion = DEFAULT_API_VERSION,
.isSystemApp = true
};
} // namespace
static bool AllocPermission(std::vector<std::string> permissions, AccessTokenID &tokenID, bool isSystemApp = true)
{
std::vector<PermissionStateFull> permissionStates;
for (const auto& permission : permissions) {
PermissionStateFull permissionState = {
.permissionName = permission,
.isGeneral = true,
.resDeviceID = {"local"},
.grantStatus = {PermissionState::PERMISSION_GRANTED},
.grantFlags = {PERMISSION_SYSTEM_FIXED}
};
permissionStates.emplace_back(permissionState);
}
HapPolicyParams hapPolicyParams = {
.apl = APL_NORMAL,
.domain = "test.domain",
.permList = {},
.permStateList = permissionStates
};
HapInfoParams hapInfoParams = {
.userID = 100,
.bundleName = "account_test",
.instIndex = 0,
.appIDDesc = "account_test",
.apiVersion = DEFAULT_API_VERSION,
.isSystemApp = isSystemApp
};
AccessTokenIDEx tokenIdEx = {0};
t
没有合适的资源?快使用搜索试试~ 我知道了~
account-os-account-帐号子系统
共1627个文件
cpp:480个
h:416个
gn:279个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 102 浏览量
2023-11-17
10:10:44
上传
评论
收藏 2.07MB ZIP 举报
温馨提示
应用程序使用操作系统帐号相关功能。在标准系统上,帐号子系统主要提供系统帐号生命周期管理,分布式帐号登录状态管理和应用帐号添加删除等基础管理能力。
资源推荐
资源详情
资源评论
收起资源包目录
account-os-account-帐号子系统 (1627个子文件)
accountmgr.cfg 2KB
CODEOWNERS 823B
os_account_manager_module_test.cpp 94KB
app_account_manager_service_module_test.cpp 92KB
app_account_manager_test.cpp 82KB
os_account_manager_service_module_test.cpp 81KB
napi_app_account.cpp 81KB
domain_account_client_module_test.cpp 76KB
os_account_control_file_manager.cpp 73KB
inner_os_account_manager.cpp 71KB
napi_os_account_common.cpp 69KB
napi_domain_account_manager.cpp 62KB
napi_app_account_common.cpp 55KB
napi_os_account.cpp 53KB
app_account_control_manager.cpp 53KB
os_account_stub.cpp 47KB
os_account_proxy.cpp 46KB
os_account_inner_account_mgr_mock.cpp 44KB
app_account_stub.cpp 44KB
napi_account_capability_scheduler.cpp 42KB
app_account_proxy.cpp 40KB
napi_account_iam_common.cpp 37KB
os_account_manager_service.cpp 35KB
account_iam_client_test.cpp 34KB
app_account_manager_service.cpp 33KB
app_account_info_test.cpp 31KB
app_account.cpp 31KB
account_mgr_inner_sdk_func_test.cpp 31KB
app_account_authenticate_test.cpp 28KB
inner_domain_account_manager.cpp 28KB
os_account_info_test.cpp 26KB
os_account_control_file_manager_test.cpp 26KB
os_account.cpp 25KB
app_account_authenticator_session_manager_module_test.cpp 25KB
ohos_account_manager.cpp 25KB
app_account_stub_test.cpp 25KB
bundle_manager_adapter_proxy.cpp 25KB
account_state_machine_test.cpp 24KB
napi_app_account_authenticator.cpp 24KB
app_account_info.cpp 23KB
napi_distributed_account.cpp 23KB
os_account_mock_test.cpp 21KB
account_appaccount_proxy_mock_test.cpp 21KB
account_osaccount_proxy_mock_test.cpp 21KB
app_account_manager_service_subscribe_module_test.cpp 20KB
account_command.cpp 20KB
os_account_interface.cpp 19KB
napi_account_iam_identity_manager.cpp 18KB
account_stub.cpp 18KB
account_iam_mgr_stub.cpp 18KB
domain_account_manager_inner_service_test.cpp 18KB
inner_app_account_manager.cpp 18KB
account_iam_client.cpp 18KB
account_iam_callback_test.cpp 17KB
bundle_manager_adapter_module_test.cpp 17KB
napi_account_iam_constant.cpp 17KB
account_iam_manager_test.cpp 16KB
app_account_authenticator_session_module_test.cpp 16KB
napi_account_common.cpp 16KB
app_account_test.cpp 16KB
inner_account_iam_manager.cpp 16KB
app_account_manager_service_sync_module_test.cpp 16KB
account_iam_mgr_proxy.cpp 16KB
os_account_manager_benchmark_test.cpp 15KB
account_command_create_test.cpp 15KB
domain_account_stub.cpp 14KB
account_mgr_service_test.cpp 14KB
app_account_execute_request_test.cpp 14KB
os_account_test.cpp 13KB
os_account_manager_service_subscribe_module_test.cpp 13KB
app_account_manager_module_test.cpp 13KB
account_dump_helper_test.cpp 13KB
napi_account_iam_user_auth.cpp 13KB
ohos_account_manager_test.cpp 13KB
domain_account_client.cpp 13KB
app_account_authenticator_session.cpp 13KB
account_mgr_service.cpp 13KB
app_account_subscribe_manager.cpp 12KB
ohos_account_data_deal.cpp 12KB
account_iam_callback.cpp 11KB
os_account_info.cpp 11KB
account_data_storage.cpp 11KB
os_account_manager.cpp 11KB
domain_account_proxy.cpp 11KB
getparam.cpp 11KB
account_iam_client_no_permission_test.cpp 11KB
account_command_set_test.cpp 11KB
mock_app_account_stub.cpp 11KB
app_account_authenticator_session_manager.cpp 10KB
domain_account_plugin_stub.cpp 10KB
os_account_database_operator.cpp 10KB
account_proxy.cpp 10KB
app_account_control_manager_module_test.cpp 10KB
app_account_authenticator_proxy.cpp 10KB
app_account_associated_data_test.cpp 10KB
app_account_common.cpp 10KB
app_account_manager.cpp 10KB
ability_manager_adapter.cpp 10KB
os_account_inner_account_mgr_cov.cpp 10KB
napi_domain_auth_callback.cpp 10KB
共 1627 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 6732
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功