diff --git a/frameworks/common/BUILD.gn b/frameworks/common/BUILD.gn index 3425637f11217356e283829b958bef2b6efdfc40..525ef28cdd7ce2d829e9c893d427912fe7253c3a 100644 --- a/frameworks/common/BUILD.gn +++ b/frameworks/common/BUILD.gn @@ -169,7 +169,9 @@ ohos_shared_library("accesstoken_common_cxx") { "src/constant_common.cpp", "src/data_validator.cpp", "src/permission_map.cpp", + "src/permission_validator.cpp", "src/time_util.cpp", + "src/tokenid_attributes.cpp", ] deps = [ diff --git a/frameworks/common/include/constant_common.h b/frameworks/common/include/constant_common.h index 82e2da2b0f2fc7eacde82fbfe7a1a76234d9da63..b3127523dc7426cace496479a6e6499d68edf6f0 100644 --- a/frameworks/common/include/constant_common.h +++ b/frameworks/common/include/constant_common.h @@ -17,6 +17,7 @@ #include #include +#include "access_token.h" namespace OHOS { namespace Security { diff --git a/services/accesstokenmanager/main/cpp/include/permission/permission_validator.h b/frameworks/common/include/permission_validator.h similarity index 100% rename from services/accesstokenmanager/main/cpp/include/permission/permission_validator.h rename to frameworks/common/include/permission_validator.h diff --git a/frameworks/common/include/tokenid_attributes.h b/frameworks/common/include/tokenid_attributes.h new file mode 100644 index 0000000000000000000000000000000000000000..d643da76d157e6d4df946c2c0dc01ec720115d92 --- /dev/null +++ b/frameworks/common/include/tokenid_attributes.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 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. + */ + +#ifndef TOKEN_ID_ATTRIBUTES_H +#define TOKEN_ID_ATTRIBUTES_H + +#include "access_token.h" + +namespace OHOS { +namespace Security { +namespace AccessToken { +class TokenIDAttributes final { +public: + static int GetTokenIdDlpFlag(AccessTokenID id); + static int GetTokenIdCloneFlag(AccessTokenID id); + static ATokenTypeEnum GetTokenIdTypeEnum(AccessTokenID id); +}; +} // namespace AccessToken +} // namespace Security +} // namespace OHOS +#endif // TOKEN_ID_ATTRIBUTES_H diff --git a/frameworks/common/src/constant_common.cpp b/frameworks/common/src/constant_common.cpp index f50940021d6d8fc4f1ba67d6b79814d17e7e3128..86bfd04254ecbb7218a5035395bb09c1ae04673e 100644 --- a/frameworks/common/src/constant_common.cpp +++ b/frameworks/common/src/constant_common.cpp @@ -77,7 +77,6 @@ uint32_t ConstantCommon::GetFlagWithoutSpecifiedElement(uint32_t fullFlag, uint3 uint32_t unmaskedFlag = (fullFlag) & (~removedFlag); return unmaskedFlag; } - } // namespace AccessToken } // namespace Security } // namespace OHOS \ No newline at end of file diff --git a/services/accesstokenmanager/main/cpp/src/permission/permission_validator.cpp b/frameworks/common/src/permission_validator.cpp similarity index 100% rename from services/accesstokenmanager/main/cpp/src/permission/permission_validator.cpp rename to frameworks/common/src/permission_validator.cpp diff --git a/frameworks/common/src/tokenid_attributes.cpp b/frameworks/common/src/tokenid_attributes.cpp new file mode 100644 index 0000000000000000000000000000000000000000..65bc5afc9deedcbb3b76f19dbcfa9e926f0df553 --- /dev/null +++ b/frameworks/common/src/tokenid_attributes.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2025 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 "tokenid_attributes.h" + +namespace OHOS { +namespace Security { +namespace AccessToken { +ATokenTypeEnum TokenIDAttributes::GetTokenIdTypeEnum(AccessTokenID id) +{ + AccessTokenIDInner* idInner = reinterpret_cast(&id); + return static_cast(idInner->type); +} + +int TokenIDAttributes::GetTokenIdDlpFlag(AccessTokenID id) +{ + AccessTokenIDInner* idInner = reinterpret_cast(&id); + return idInner->dlpFlag; +} + +int TokenIDAttributes::GetTokenIdCloneFlag(AccessTokenID id) +{ + AccessTokenIDInner* idInner = reinterpret_cast(&id); + return idInner->cloneFlag; +} +} // namespace AccessToken +} // namespace Security +} // namespace OHOS diff --git a/services/accesstokenmanager/BUILD.gn b/services/accesstokenmanager/BUILD.gn index 31f990850c7c455baa9a74ba4601184138ec0a32..ae86f506172e621184abd9df0255421c2a91e851 100644 --- a/services/accesstokenmanager/BUILD.gn +++ b/services/accesstokenmanager/BUILD.gn @@ -81,17 +81,16 @@ if (is_standard_system) { "main/cpp/src/form_manager/form_manager_access_proxy.cpp", "main/cpp/src/form_manager/form_manager_death_recipient.cpp", "main/cpp/src/form_manager/form_status_change_callback.cpp", + "main/cpp/src/permission/accesstoken_id_manager.cpp", + "main/cpp/src/permission/accesstoken_info_manager.cpp", + "main/cpp/src/permission/hap_token_info_inner.cpp", "main/cpp/src/permission/permission_data_brief.cpp", "main/cpp/src/permission/permission_grant_event.cpp", "main/cpp/src/permission/permission_manager.cpp", - "main/cpp/src/permission/permission_validator.cpp", "main/cpp/src/permission/short_grant_manager.cpp", "main/cpp/src/permission/temp_permission_observer.cpp", "main/cpp/src/seccomp/sec_comp_monitor.cpp", "main/cpp/src/service/accesstoken_manager_service.cpp", - "main/cpp/src/token/accesstoken_id_manager.cpp", - "main/cpp/src/token/accesstoken_info_manager.cpp", - "main/cpp/src/token/hap_token_info_inner.cpp", ] cflags_cc = [ @@ -157,8 +156,8 @@ if (is_standard_system) { cflags_cc += [ "-DTOKEN_SYNC_ENABLE" ] sources += [ - "main/cpp/src/token/accesstoken_remote_token_manager.cpp", - "main/cpp/src/token/token_modify_notifier.cpp", + "main/cpp/src/permission/accesstoken_remote_token_manager.cpp", + "main/cpp/src/permission/token_modify_notifier.cpp", ] include_dirs += diff --git a/services/accesstokenmanager/main/cpp/include/token/accesstoken_id_manager.h b/services/accesstokenmanager/main/cpp/include/permission/accesstoken_id_manager.h similarity index 92% rename from services/accesstokenmanager/main/cpp/include/token/accesstoken_id_manager.h rename to services/accesstokenmanager/main/cpp/include/permission/accesstoken_id_manager.h index f4b8ce39ccbe3a36fa57f48f4511cd3cc37ceb3e..c4e8bb678e60b6d899f1bf18694356f3ba7e7106 100644 --- a/services/accesstokenmanager/main/cpp/include/token/accesstoken_id_manager.h +++ b/services/accesstokenmanager/main/cpp/include/permission/accesstoken_id_manager.h @@ -39,10 +39,6 @@ public: int RegisterTokenId(AccessTokenID id, ATokenTypeEnum type); void ReleaseTokenId(AccessTokenID id); ATokenTypeEnum GetTokenIdType(AccessTokenID id); - int GetTokenIdDlpFlag(AccessTokenID id); - int GetTokenIdCloneFlag(AccessTokenID id); - static ATokenTypeEnum GetTokenIdTypeEnum(AccessTokenID id); - private: AccessTokenIDManager() = default; DISALLOW_COPY_AND_MOVE(AccessTokenIDManager); diff --git a/services/accesstokenmanager/main/cpp/include/token/accesstoken_info_manager.h b/services/accesstokenmanager/main/cpp/include/permission/accesstoken_info_manager.h similarity index 100% rename from services/accesstokenmanager/main/cpp/include/token/accesstoken_info_manager.h rename to services/accesstokenmanager/main/cpp/include/permission/accesstoken_info_manager.h diff --git a/services/accesstokenmanager/main/cpp/include/token/accesstoken_remote_token_manager.h b/services/accesstokenmanager/main/cpp/include/permission/accesstoken_remote_token_manager.h similarity index 100% rename from services/accesstokenmanager/main/cpp/include/token/accesstoken_remote_token_manager.h rename to services/accesstokenmanager/main/cpp/include/permission/accesstoken_remote_token_manager.h diff --git a/services/accesstokenmanager/main/cpp/include/token/hap_token_info_inner.h b/services/accesstokenmanager/main/cpp/include/permission/hap_token_info_inner.h similarity index 100% rename from services/accesstokenmanager/main/cpp/include/token/hap_token_info_inner.h rename to services/accesstokenmanager/main/cpp/include/permission/hap_token_info_inner.h diff --git a/services/accesstokenmanager/main/cpp/include/token/native_token_info_base.h b/services/accesstokenmanager/main/cpp/include/permission/native_token_info_base.h similarity index 100% rename from services/accesstokenmanager/main/cpp/include/token/native_token_info_base.h rename to services/accesstokenmanager/main/cpp/include/permission/native_token_info_base.h diff --git a/services/accesstokenmanager/main/cpp/include/token/token_modify_notifier.h b/services/accesstokenmanager/main/cpp/include/permission/token_modify_notifier.h similarity index 100% rename from services/accesstokenmanager/main/cpp/include/token/token_modify_notifier.h rename to services/accesstokenmanager/main/cpp/include/permission/token_modify_notifier.h diff --git a/services/accesstokenmanager/main/cpp/src/token/accesstoken_id_manager.cpp b/services/accesstokenmanager/main/cpp/src/permission/accesstoken_id_manager.cpp similarity index 87% rename from services/accesstokenmanager/main/cpp/src/token/accesstoken_id_manager.cpp rename to services/accesstokenmanager/main/cpp/src/permission/accesstoken_id_manager.cpp index bec5c98d12d546105244a538f2b18b16a89d1e74..8e9cd71a95cde83b245120d09270f759b5c215fe 100644 --- a/services/accesstokenmanager/main/cpp/src/token/accesstoken_id_manager.cpp +++ b/services/accesstokenmanager/main/cpp/src/permission/accesstoken_id_manager.cpp @@ -19,6 +19,7 @@ #include "access_token_error.h" #include "data_validator.h" #include "random.h" +#include "tokenid_attributes.h" namespace OHOS { namespace Security { @@ -27,24 +28,6 @@ namespace { std::recursive_mutex g_instanceMutex; } -ATokenTypeEnum AccessTokenIDManager::GetTokenIdTypeEnum(AccessTokenID id) -{ - AccessTokenIDInner *idInner = reinterpret_cast(&id); - return static_cast(idInner->type); -} - -int AccessTokenIDManager::GetTokenIdDlpFlag(AccessTokenID id) -{ - AccessTokenIDInner *idInner = reinterpret_cast(&id); - return idInner->dlpFlag; -} - -int AccessTokenIDManager::GetTokenIdCloneFlag(AccessTokenID id) -{ - AccessTokenIDInner *idInner = reinterpret_cast(&id); - return idInner->cloneFlag; -} - ATokenTypeEnum AccessTokenIDManager::GetTokenIdType(AccessTokenID id) { { @@ -53,7 +36,7 @@ ATokenTypeEnum AccessTokenIDManager::GetTokenIdType(AccessTokenID id) return TOKEN_INVALID; } } - return GetTokenIdTypeEnum(id); + return TokenIDAttributes::GetTokenIdTypeEnum(id); } int AccessTokenIDManager::RegisterTokenId(AccessTokenID id, ATokenTypeEnum type) diff --git a/services/accesstokenmanager/main/cpp/src/token/accesstoken_info_manager.cpp b/services/accesstokenmanager/main/cpp/src/permission/accesstoken_info_manager.cpp similarity index 99% rename from services/accesstokenmanager/main/cpp/src/token/accesstoken_info_manager.cpp rename to services/accesstokenmanager/main/cpp/src/permission/accesstoken_info_manager.cpp index bf1ca84f883742c22c1ad081e3a27d09b804b2d4..4890ca1c91e33fefeefdb51746d2d644d70cb20e 100644 --- a/services/accesstokenmanager/main/cpp/src/token/accesstoken_info_manager.cpp +++ b/services/accesstokenmanager/main/cpp/src/permission/accesstoken_info_manager.cpp @@ -45,6 +45,7 @@ #include "permission_map.h" #include "permission_validator.h" #include "perm_setproc.h" +#include "tokenid_attributes.h" #include "token_field_const.h" #include "token_setproc.h" #ifdef TOKEN_SYNC_ENABLE @@ -105,6 +106,8 @@ void AccessTokenInfoManager::Init(uint32_t& hapSize, uint32_t& nativeSize, uint3 if (ret != RET_SUCCESS) { ReportSysEventServiceStartError( INIT_NATIVE_TOKENINFO_ERROR, "GetAllNativeTokenInfo fail from native json.", ret); + LOGE(ATM_DOMAIN, ATM_TAG, "Failed to load native from native json, err=%{public}d.", ret); + return; } #ifdef SUPPORT_SANDBOX_APP @@ -680,7 +683,7 @@ void AccessTokenInfoManager::InitNativeTokenInfos(const std::vector infoGuard(this->hapTokenInfoLock_); if (hapTokenInfoMap_.count(mapID) == 0) { @@ -937,8 +940,8 @@ int AccessTokenInfoManager::DeleteRemoteToken(const std::string& deviceID, Acces AccessTokenID AccessTokenInfoManager::GetRemoteNativeTokenID(const std::string& deviceID, AccessTokenID tokenID) { if ((!DataValidator::IsDeviceIdValid(deviceID)) || (tokenID == 0) || - ((AccessTokenIDManager::GetInstance().GetTokenIdTypeEnum(tokenID) != TOKEN_NATIVE) && - (AccessTokenIDManager::GetInstance().GetTokenIdTypeEnum(tokenID) != TOKEN_SHELL))) { + ((TokenIDAttributes::GetTokenIdTypeEnum(tokenID) != TOKEN_NATIVE) && + (TokenIDAttributes::GetTokenIdTypeEnum(tokenID) != TOKEN_SHELL))) { LOGE(ATM_DOMAIN, ATM_TAG, "Device %{public}s parms invalid.", ConstantCommon::EncryptDevId(deviceID).c_str()); return 0; @@ -1681,7 +1684,7 @@ int32_t AccessTokenInfoManager::VerifyAccessToken(AccessTokenID tokenID, const s return PERMISSION_DENIED; } - ATokenTypeEnum tokenType = AccessTokenIDManager::GetInstance().GetTokenIdTypeEnum(tokenID); + ATokenTypeEnum tokenType = TokenIDAttributes::GetTokenIdTypeEnum(tokenID); if ((tokenType == TOKEN_NATIVE) || (tokenType == TOKEN_SHELL)) { return VerifyNativeAccessToken(tokenID, permissionName); } diff --git a/services/accesstokenmanager/main/cpp/src/token/accesstoken_remote_token_manager.cpp b/services/accesstokenmanager/main/cpp/src/permission/accesstoken_remote_token_manager.cpp similarity index 95% rename from services/accesstokenmanager/main/cpp/src/token/accesstoken_remote_token_manager.cpp rename to services/accesstokenmanager/main/cpp/src/permission/accesstoken_remote_token_manager.cpp index 855fd6335415f84bdaa9a61b31011b1cd6aefaec..abaf9ff073cb1a64ae3d308d930d244d857f42fb 100644 --- a/services/accesstokenmanager/main/cpp/src/token/accesstoken_remote_token_manager.cpp +++ b/services/accesstokenmanager/main/cpp/src/permission/accesstoken_remote_token_manager.cpp @@ -20,6 +20,8 @@ #include "access_token_error.h" #include "data_validator.h" #include "constant_common.h" +#include "tokenid_attributes.h" + namespace OHOS { namespace Security { namespace AccessToken { @@ -54,13 +56,13 @@ AccessTokenID AccessTokenRemoteTokenManager::MapRemoteDeviceTokenToLocal(const s ConstantCommon::EncryptDevId(deviceID).c_str(), remoteID); return 0; } - ATokenTypeEnum tokeType = AccessTokenIDManager::GetInstance().GetTokenIdTypeEnum(remoteID); + ATokenTypeEnum tokeType = TokenIDAttributes::GetTokenIdTypeEnum(remoteID); if ((tokeType <= TOKEN_INVALID) || (tokeType >= TOKEN_TYPE_BUTT)) { LOGE(ATM_DOMAIN, ATM_TAG, "Token %{public}x type is invalid.", remoteID); return 0; } - int32_t dlpFlag = AccessTokenIDManager::GetInstance().GetTokenIdDlpFlag(remoteID); - int32_t cloneFlag = AccessTokenIDManager::GetInstance().GetTokenIdCloneFlag(remoteID); + int32_t dlpFlag = TokenIDAttributes::GetTokenIdDlpFlag(remoteID); + int32_t cloneFlag = TokenIDAttributes::GetTokenIdCloneFlag(remoteID); AccessTokenID mapID = 0; Utils::UniqueWriteGuard infoGuard(this->remoteDeviceLock_); diff --git a/services/accesstokenmanager/main/cpp/src/token/hap_token_info_inner.cpp b/services/accesstokenmanager/main/cpp/src/permission/hap_token_info_inner.cpp similarity index 100% rename from services/accesstokenmanager/main/cpp/src/token/hap_token_info_inner.cpp rename to services/accesstokenmanager/main/cpp/src/permission/hap_token_info_inner.cpp diff --git a/services/accesstokenmanager/main/cpp/src/permission/permission_data_brief.cpp b/services/accesstokenmanager/main/cpp/src/permission/permission_data_brief.cpp index eb326beced1ed81b8f7f984a74d0d099dd035933..cbfb0b69135a39e70b7a551188ed90cfa708e3e5 100644 --- a/services/accesstokenmanager/main/cpp/src/permission/permission_data_brief.cpp +++ b/services/accesstokenmanager/main/cpp/src/permission/permission_data_brief.cpp @@ -28,6 +28,7 @@ #include "permission_validator.h" #include "accesstoken_id_manager.h" #include "data_validator.h" +#include "tokenid_attributes.h" #include "token_field_const.h" #include "data_translator.h" @@ -245,7 +246,7 @@ void PermissionDataBrief::AddPermToBriefPermission( AccessTokenID tokenId, const std::vector& permStateList, const std::map& aclExtendedMap, bool defCheck) { - ATokenTypeEnum tokenType = AccessTokenIDManager::GetInstance().GetTokenIdTypeEnum(tokenId); + ATokenTypeEnum tokenType = TokenIDAttributes::GetTokenIdTypeEnum(tokenId); std::vector permStateListRes; if (defCheck) { PermissionValidator::FilterInvalidPermissionState(tokenType, true, permStateList, permStateListRes); diff --git a/services/accesstokenmanager/main/cpp/src/permission/permission_manager.cpp b/services/accesstokenmanager/main/cpp/src/permission/permission_manager.cpp index 1e53a593766040ae4ba75c42f52bf36b378a3d8f..d8c3deda976f6f61b5c70f8815eb7a8875c2e17a 100644 --- a/services/accesstokenmanager/main/cpp/src/permission/permission_manager.cpp +++ b/services/accesstokenmanager/main/cpp/src/permission/permission_manager.cpp @@ -41,6 +41,7 @@ #include "permission_map.h" #include "permission_validator.h" #include "perm_setproc.h" +#include "tokenid_attributes.h" #include "token_field_const.h" #ifdef TOKEN_SYNC_ENABLE #include "token_modify_notifier.h" @@ -123,7 +124,7 @@ PermUsedTypeEnum PermissionManager::GetPermissionUsedType( AccessTokenID tokenID, const std::string& permissionName) { if ((tokenID == INVALID_TOKENID) || - (TOKEN_HAP != AccessTokenIDManager::GetInstance().GetTokenIdTypeEnum(tokenID))) { + (TOKEN_HAP != TokenIDAttributes::GetTokenIdTypeEnum(tokenID))) { LOGE(ATM_DOMAIN, ATM_TAG, "TokenID: %{public}d is invalid.", tokenID); return PermUsedTypeEnum::INVALID_USED_TYPE; } diff --git a/services/accesstokenmanager/main/cpp/src/token/token_modify_notifier.cpp b/services/accesstokenmanager/main/cpp/src/permission/token_modify_notifier.cpp similarity index 100% rename from services/accesstokenmanager/main/cpp/src/token/token_modify_notifier.cpp rename to services/accesstokenmanager/main/cpp/src/permission/token_modify_notifier.cpp diff --git a/services/accesstokenmanager/main/cpp/src/service/accesstoken_manager_service.cpp b/services/accesstokenmanager/main/cpp/src/service/accesstoken_manager_service.cpp index fb3f764212f6f556db53d908c5887bdca2f2a3d1..cf0043e310a4ef24b92fcebc60b181d7306eeac4 100644 --- a/services/accesstokenmanager/main/cpp/src/service/accesstoken_manager_service.cpp +++ b/services/accesstokenmanager/main/cpp/src/service/accesstoken_manager_service.cpp @@ -51,6 +51,7 @@ #include "string_ex.h" #include "system_ability_definition.h" #include "time_util.h" +#include "tokenid_attributes.h" #include "token_field_const.h" #ifdef TOKEN_SYNC_ENABLE #include "token_modify_notifier.h" @@ -191,7 +192,7 @@ int AccessTokenManagerService::VerifyAccessToken(AccessTokenID tokenID, const st LOGD(ATM_DOMAIN, ATM_TAG, "TokenID: %{public}d, permission: %{public}s, res %{public}d", tokenID, permissionName.c_str(), res); if ((res == PERMISSION_GRANTED) && - (AccessTokenIDManager::GetInstance().GetTokenIdTypeEnum(tokenID) == TOKEN_HAP)) { + (TokenIDAttributes::GetTokenIdTypeEnum(tokenID) == TOKEN_HAP)) { res = AccessTokenInfoManager::GetInstance().IsPermissionRestrictedByUserPolicy(tokenID, permissionName) ? PERMISSION_DENIED : PERMISSION_GRANTED; } diff --git a/services/accesstokenmanager/test/coverage/BUILD.gn b/services/accesstokenmanager/test/coverage/BUILD.gn index ab13cadf05092ea821a3a79f15b651e843df22b6..e5e79063f6b90e3e63fb4972552a3aa14b90bada 100644 --- a/services/accesstokenmanager/test/coverage/BUILD.gn +++ b/services/accesstokenmanager/test/coverage/BUILD.gn @@ -33,13 +33,12 @@ accesstoken_manager_service_source = [ "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_grant_event.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_manager.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/short_grant_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_validator.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/temp_permission_observer.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_monitor.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/service/accesstoken_manager_service.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_id_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_info_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/hap_token_info_inner.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_id_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_info_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/hap_token_info_inner.cpp", "${access_token_path}/services/accesstokenmanager/test/unittest/parameter.cpp", "${access_token_path}/services/accesstokenmanager/test/unittest/parameters.cpp", ] @@ -79,7 +78,7 @@ ohos_unittest("libaccesstoken_manager_service_coverage_test") { "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", "${access_token_path}/services/accesstokenmanager/main/cpp/include/seccomp", "${access_token_path}/services/accesstokenmanager/main/cpp/include/service", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", "${access_token_path}/services/accesstokenmanager/test/unittest", ] @@ -125,8 +124,8 @@ ohos_unittest("libaccesstoken_manager_service_coverage_test") { if (token_sync_enable == true) { cflags_cc += [ "-DTOKEN_SYNC_ENABLE" ] sources += [ - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_remote_token_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/token_modify_notifier.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_remote_token_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/token_modify_notifier.cpp", ] include_dirs += [ "${access_token_path}/interfaces/innerkits/tokensync/include", diff --git a/services/accesstokenmanager/test/database_dlopen/BUILD.gn b/services/accesstokenmanager/test/database_dlopen/BUILD.gn index 17c82f1a0c2c638f362051f0dbd3be4393d26568..cd1b2df13cb0fe00c8247bbb3279488b9ad744ec 100644 --- a/services/accesstokenmanager/test/database_dlopen/BUILD.gn +++ b/services/accesstokenmanager/test/database_dlopen/BUILD.gn @@ -31,13 +31,12 @@ accesstoken_manager_service_source = [ "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_grant_event.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_manager.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/short_grant_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_validator.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/temp_permission_observer.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_monitor.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/service/accesstoken_manager_service.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_id_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_info_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/hap_token_info_inner.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_id_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_info_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/hap_token_info_inner.cpp", ] ohos_unittest("libaccesstoken_manager_service_dlopen_test") { @@ -75,7 +74,7 @@ ohos_unittest("libaccesstoken_manager_service_dlopen_test") { "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", "${access_token_path}/services/accesstokenmanager/main/cpp/include/seccomp", "${access_token_path}/services/accesstokenmanager/main/cpp/include/service", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", ] sources = [ "database_dlopen_coverage_test.cpp" ] @@ -122,8 +121,8 @@ ohos_unittest("libaccesstoken_manager_service_dlopen_test") { if (token_sync_enable == true) { cflags_cc += [ "-DTOKEN_SYNC_ENABLE" ] sources += [ - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_remote_token_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/token_modify_notifier.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_remote_token_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/token_modify_notifier.cpp", ] include_dirs += [ "${access_token_path}/interfaces/innerkits/tokensync/include", diff --git a/services/accesstokenmanager/test/mock/BUILD.gn b/services/accesstokenmanager/test/mock/BUILD.gn index 71d431049ee70e0d85df84acbf75f467689c8abb..242540a7179aafb0225d851c2dbbb3e696d8a300 100644 --- a/services/accesstokenmanager/test/mock/BUILD.gn +++ b/services/accesstokenmanager/test/mock/BUILD.gn @@ -33,13 +33,12 @@ accesstoken_manager_service_source = [ "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_grant_event.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_manager.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/short_grant_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_validator.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/temp_permission_observer.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_monitor.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/service/accesstoken_manager_service.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_id_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_info_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/hap_token_info_inner.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_id_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_info_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/hap_token_info_inner.cpp", ] ohos_unittest("libpermission_manager_mock_test") { @@ -76,7 +75,7 @@ ohos_unittest("libpermission_manager_mock_test") { "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", "${access_token_path}/services/accesstokenmanager/main/cpp/include/seccomp", "${access_token_path}/services/accesstokenmanager/main/cpp/include/service", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", ] sources = [ diff --git a/services/accesstokenmanager/test/unittest/BUILD.gn b/services/accesstokenmanager/test/unittest/BUILD.gn index acfdd097e84dab6115ada449714de00c766fe8e7..084f5b13dc46aa87d7e8fc41762998876d5e1e20 100644 --- a/services/accesstokenmanager/test/unittest/BUILD.gn +++ b/services/accesstokenmanager/test/unittest/BUILD.gn @@ -33,13 +33,12 @@ accesstoken_manager_service_source = [ "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_grant_event.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_manager.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/short_grant_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_validator.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/temp_permission_observer.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_monitor.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/service/accesstoken_manager_service.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_id_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_info_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/hap_token_info_inner.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_id_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_info_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/hap_token_info_inner.cpp", ] ohos_unittest("libaccesstoken_manager_service_standard_test") { @@ -77,7 +76,7 @@ ohos_unittest("libaccesstoken_manager_service_standard_test") { "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", "${access_token_path}/services/accesstokenmanager/main/cpp/include/seccomp", "${access_token_path}/services/accesstokenmanager/main/cpp/include/service", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", "${access_token_path}/services/accesstokenmanager/test/unittest", ] @@ -142,8 +141,8 @@ ohos_unittest("libaccesstoken_manager_service_standard_test") { if (token_sync_enable == true) { cflags_cc += [ "-DTOKEN_SYNC_ENABLE" ] sources += [ - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_remote_token_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/token_modify_notifier.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_remote_token_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/token_modify_notifier.cpp", ] include_dirs += [ "${access_token_path}/interfaces/innerkits/tokensync/include", diff --git a/services/common/database/test/BUILD.gn b/services/common/database/test/BUILD.gn index 04003e26121f0d07002a283edf3ae5d501aec707..95c47726623d601bcd2566d9e54df525ccac528f 100644 --- a/services/common/database/test/BUILD.gn +++ b/services/common/database/test/BUILD.gn @@ -34,7 +34,7 @@ ohos_unittest("libdatabase_test") { "${access_token_path}/services/accesstokenmanager/main/cpp/include/database", "${access_token_path}/services/accesstokenmanager/main/cpp/include/dfx", "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", ] sources = [ @@ -44,7 +44,6 @@ ohos_unittest("libdatabase_test") { "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/access_token_open_callback.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/data_translator.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/token_field_const.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_validator.cpp", "unittest/database_test.cpp", ] diff --git a/services/common/json_parse/BUILD.gn b/services/common/json_parse/BUILD.gn index fa80142e1a53ca8fbe7c693e3f41fc7ba2fb29d5..bc3adbd5aaa4ecfe0c32139a64bb556b1a085aa9 100644 --- a/services/common/json_parse/BUILD.gn +++ b/services/common/json_parse/BUILD.gn @@ -35,7 +35,7 @@ ohos_shared_library("accesstoken_json_parse") { "${access_token_path}/frameworks/common/include", "${access_token_path}/frameworks/json_adapter/include", "${access_token_path}/interfaces/innerkits/accesstoken/include", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", ] sources = [ diff --git a/services/common/json_parse/test/BUILD.gn b/services/common/json_parse/test/BUILD.gn index 2ddc8f970ee4c7d643adafdbdd5e971470c9d71d..d7e012ed40b78543b333334b5e73a2770ce07db3 100644 --- a/services/common/json_parse/test/BUILD.gn +++ b/services/common/json_parse/test/BUILD.gn @@ -33,7 +33,7 @@ ohos_unittest("libjsonparse_test") { "${access_token_path}/frameworks/json_adapter/include", "${access_token_path}/frameworks/common/include", "${access_token_path}/interfaces/innerkits/accesstoken/include", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", "${access_token_path}/services/common/json_parse/include", ] diff --git a/services/privacymanager/BUILD.gn b/services/privacymanager/BUILD.gn index 9678e02360eee8d4b566aae5c673c8fd458e642f..7b6242978f6c6bc58e385a39a10f611557447742 100644 --- a/services/privacymanager/BUILD.gn +++ b/services/privacymanager/BUILD.gn @@ -160,7 +160,7 @@ if (is_standard_system && ability_base_enable == true) { "${access_token_path}/services/common/libraryloader/include", "${access_token_path}/services/common/screenlock_manager/include", "${access_token_path}/services/common/utils/include", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", ] sources = [ diff --git a/services/privacymanager/test/coverage/BUILD.gn b/services/privacymanager/test/coverage/BUILD.gn index d5822382a8fc95587faf15f664ab441a5412cd31..9e516d115580f09babfa5f6314dc830ab5c87ed7 100644 --- a/services/privacymanager/test/coverage/BUILD.gn +++ b/services/privacymanager/test/coverage/BUILD.gn @@ -48,7 +48,7 @@ if (is_standard_system && ability_base_enable == true) { "${access_token_path}/services/privacymanager/include/proxy", "${access_token_path}/services/privacymanager/include/sensitive/audio_manager", "${access_token_path}/services/privacymanager/include/sensitive/camera_manager", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", ] sources = [ diff --git a/services/privacymanager/test/mock/BUILD.gn b/services/privacymanager/test/mock/BUILD.gn index 21eb3f27954a352b24bee7c87be2fd29bdfdde9b..88e728ec6f7544daa58ba0e5609db746f530188b 100644 --- a/services/privacymanager/test/mock/BUILD.gn +++ b/services/privacymanager/test/mock/BUILD.gn @@ -48,7 +48,7 @@ if (is_standard_system && ability_base_enable == true) { "${access_token_path}/services/privacymanager/include/proxy", "${access_token_path}/services/privacymanager/include/sensitive/audio_manager", "${access_token_path}/services/privacymanager/include/sensitive/camera_manager", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", ] sources = [ diff --git a/services/privacymanager/test/unittest/BUILD.gn b/services/privacymanager/test/unittest/BUILD.gn index 42b660f4e698062b8b40116ad19c27eeb868c842..d636dba18a0439bf2a3cc6ab5204bd195c966492 100644 --- a/services/privacymanager/test/unittest/BUILD.gn +++ b/services/privacymanager/test/unittest/BUILD.gn @@ -49,7 +49,7 @@ if (is_standard_system && ability_base_enable == true) { "${access_token_path}/services/privacymanager/include/proxy", "${access_token_path}/services/privacymanager/include/sensitive/audio_manager", "${access_token_path}/services/privacymanager/include/sensitive/camera_manager", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", ] sources = [ diff --git a/services/tokensyncmanager/BUILD.gn b/services/tokensyncmanager/BUILD.gn index e61907d1f09da94d7499ee69506dea2ba04c06fe..6ed9366f1d681328488e7709d868c777c76a8f89 100644 --- a/services/tokensyncmanager/BUILD.gn +++ b/services/tokensyncmanager/BUILD.gn @@ -58,7 +58,7 @@ if (token_sync_enable == true) { "${access_token_path}/frameworks/tokensync/include", "${access_token_path}/interfaces/innerkits/accesstoken/include", "${access_token_path}/interfaces/innerkits/tokensync/include", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", "${access_token_path}/frameworks/json_adapter/include", "${access_token_path}/services/common/json_parse/include", "${access_token_path}/services/common/handler/include", diff --git a/services/tokensyncmanager/src/device/device_info_manager.cpp b/services/tokensyncmanager/src/device/device_info_manager.cpp index cebf8c5a4917a408a6ed2d4d8e51e8484a762258..6c32c4e173c06e8843955f886b77d08de937c206 100644 --- a/services/tokensyncmanager/src/device/device_info_manager.cpp +++ b/services/tokensyncmanager/src/device/device_info_manager.cpp @@ -97,16 +97,7 @@ std::string DeviceInfoManager::ConvertToUniversallyUniqueIdOrFetch(const std::st if (!(DeviceInfoRepository::GetInstance().FindDeviceInfo(nodeId, DeviceIdType::UNKNOWN, deviceInfo))) { return result; } - std::string universallyUniqueId = deviceInfo.deviceId.universallyUniqueId; - if (!universallyUniqueId.empty()) { - result = universallyUniqueId; - return result; - } - std::string udid = SoftBusManager::GetInstance().GetUniversallyUniqueIdByNodeId(nodeId); - if (!udid.empty()) { - result = udid; - } - return result; + return deviceInfo.deviceId.universallyUniqueId; } std::string DeviceInfoManager::ConvertToUniqueDeviceIdOrFetch(const std::string &nodeId) const diff --git a/services/tokensyncmanager/src/remote/soft_bus_device_connection_listener.cpp b/services/tokensyncmanager/src/remote/soft_bus_device_connection_listener.cpp index 83e7def6bb2669dea04561316c05bf17a7cd3eab..b1fed6a56e5e5890520334e43851ed7708bc55ce 100644 --- a/services/tokensyncmanager/src/remote/soft_bus_device_connection_listener.cpp +++ b/services/tokensyncmanager/src/remote/soft_bus_device_connection_listener.cpp @@ -86,6 +86,9 @@ void SoftBusDeviceConnectionListener::OnDeviceOffline(const DistributedHardware: { std::string networkId = std::string(info.networkId); std::string uuid = DeviceInfoManager::GetInstance().ConvertToUniversallyUniqueIdOrFetch(networkId); + if (uuid.empty()) { + uuid = SoftBusManager::GetInstance().GetUniversallyUniqueIdByNodeId(networkId); + } std::string udid = DeviceInfoManager::GetInstance().ConvertToUniqueDeviceIdOrFetch(networkId); if ((uuid == "") || (udid == "")) { LOGE(ATM_DOMAIN, ATM_TAG, "Uuid or udid is empty, offline failed."); diff --git a/services/tokensyncmanager/test/coverage/BUILD.gn b/services/tokensyncmanager/test/coverage/BUILD.gn index 5914bd47def68abab3e85963c1303b11bcab5ab1..120249ee02aff4a2f3a72aff5c7751207b60c9e2 100644 --- a/services/tokensyncmanager/test/coverage/BUILD.gn +++ b/services/tokensyncmanager/test/coverage/BUILD.gn @@ -60,7 +60,7 @@ ohos_unittest("libtoken_sync_service_coverage_test") { "${access_token_path}/interfaces/innerkits/accesstoken/include", "${access_token_path}/interfaces/innerkits/nativetoken/include", "${access_token_path}/interfaces/innerkits/token_setproc/include", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", "${access_token_path}/frameworks/json_adapter/include", "${access_token_path}/services/common/json_parse/include", "${access_token_path}/services/common/handler/include", diff --git a/services/tokensyncmanager/test/coverage/token_sync_service_coverage_test.cpp b/services/tokensyncmanager/test/coverage/token_sync_service_coverage_test.cpp index 10b888c2f2a09fe3202051c4f63b18379515d8fb..5ac876c5242d263c1fecd2726f8e351baabc9fa6 100644 --- a/services/tokensyncmanager/test/coverage/token_sync_service_coverage_test.cpp +++ b/services/tokensyncmanager/test/coverage/token_sync_service_coverage_test.cpp @@ -135,6 +135,9 @@ void TokenSyncServiceTest::OnDeviceOffline(const DistributedHardware::DmDeviceIn { std::string networkId = info.networkId; std::string uuid = DeviceInfoManager::GetInstance().ConvertToUniversallyUniqueIdOrFetch(networkId); + if (uuid.empty()) { + uuid = SoftBusManager::GetInstance().GetUniversallyUniqueIdByNodeId(networkId); + } std::string udid = DeviceInfoManager::GetInstance().ConvertToUniqueDeviceIdOrFetch(networkId); LOGI(ATM_DOMAIN, ATM_TAG, diff --git a/services/tokensyncmanager/test/unittest/BUILD.gn b/services/tokensyncmanager/test/unittest/BUILD.gn index e4aef09a20cf44a4d112faf3db8ccc3db020f087..e4dd1197e6e3e259a13f2c7573d389e4133d91c4 100644 --- a/services/tokensyncmanager/test/unittest/BUILD.gn +++ b/services/tokensyncmanager/test/unittest/BUILD.gn @@ -60,7 +60,7 @@ ohos_unittest("libtoken_sync_service_standard_test") { "${access_token_path}/interfaces/innerkits/accesstoken/include", "${access_token_path}/interfaces/innerkits/nativetoken/include", "${access_token_path}/interfaces/innerkits/token_setproc/include", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", "${access_token_path}/frameworks/json_adapter/include", "${access_token_path}/services/common/json_parse/include", "${access_token_path}/services/common/handler/include", diff --git a/services/tokensyncmanager/test/unittest/token_sync_service_test.cpp b/services/tokensyncmanager/test/unittest/token_sync_service_test.cpp index 9df60367e5eb5fccf94cc1d95e460bfef269b6f6..081c8fef88adf43c9ae0efc5df2e19daa038f410 100644 --- a/services/tokensyncmanager/test/unittest/token_sync_service_test.cpp +++ b/services/tokensyncmanager/test/unittest/token_sync_service_test.cpp @@ -144,6 +144,9 @@ void TokenSyncServiceTest::OnDeviceOffline(const DistributedHardware::DmDeviceIn { std::string networkId = info.networkId; std::string uuid = DeviceInfoManager::GetInstance().ConvertToUniversallyUniqueIdOrFetch(networkId); + if (uuid.empty()) { + uuid = SoftBusManager::GetInstance().GetUniversallyUniqueIdByNodeId(networkId); + } std::string udid = DeviceInfoManager::GetInstance().ConvertToUniqueDeviceIdOrFetch(networkId); LOGI(ATM_DOMAIN, ATM_TAG, diff --git a/test/fuzztest/normalize_service/accesstoken/access_token_service_fuzz.gni b/test/fuzztest/normalize_service/accesstoken/access_token_service_fuzz.gni index 871feeae778aae5c8c3c34b16db30538074b271a..3c1bdd368c3ffba4e25945b7a1d9aea2f7e779ec 100644 --- a/test/fuzztest/normalize_service/accesstoken/access_token_service_fuzz.gni +++ b/test/fuzztest/normalize_service/accesstoken/access_token_service_fuzz.gni @@ -22,7 +22,7 @@ access_token_include_dirs = [ "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", "${access_token_path}/services/accesstokenmanager/main/cpp/include/seccomp", "${access_token_path}/services/accesstokenmanager/main/cpp/include/service", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", "${access_token_path}/services/tokensyncmanager/include/service", "${access_token_path}/services/tokensyncmanager/include/remote", "${access_token_path}/services/tokensyncmanager/include/command", @@ -85,9 +85,9 @@ access_token_sources = [ "${access_token_path}/services/accesstokenmanager/main/cpp/src/callback/accesstoken_callback_proxys.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/callback/callback_death_recipients.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/callback/callback_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/access_token_db.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/access_token_db_operator.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/access_token_db_util.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/access_token_db.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/access_token_open_callback.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/data_translator.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/database/token_field_const.cpp", @@ -96,17 +96,16 @@ access_token_sources = [ "${access_token_path}/services/accesstokenmanager/main/cpp/src/form_manager/form_manager_access_proxy.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/form_manager/form_manager_death_recipient.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/form_manager/form_status_change_callback.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_id_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_info_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/hap_token_info_inner.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_data_brief.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_grant_event.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_validator.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/short_grant_manager.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/temp_permission_observer.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_monitor.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/service/accesstoken_manager_service.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_id_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_info_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/hap_token_info_inner.cpp", ] token_sync_sources = [ @@ -147,8 +146,8 @@ if (token_sync_enable == true) { "-DFUZZ_ENABLE", ] access_token_sources += [ - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_remote_token_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/token_modify_notifier.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_remote_token_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/token_modify_notifier.cpp", "${access_token_path}/services/common/libraryloader/src/libraryloader.cpp", ] access_token_include_dirs += [ diff --git a/test/fuzztest/services/accesstoken/access_token_service_fuzz.gni b/test/fuzztest/services/accesstoken/access_token_service_fuzz.gni index 713608566048d4f4a4542af94378194501cea688..8aacfac63b74cf840165ad1721c1ec26518fb0c2 100644 --- a/test/fuzztest/services/accesstoken/access_token_service_fuzz.gni +++ b/test/fuzztest/services/accesstoken/access_token_service_fuzz.gni @@ -23,7 +23,7 @@ access_token_include_dirs = [ "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", "${access_token_path}/services/accesstokenmanager/main/cpp/include/seccomp", "${access_token_path}/services/accesstokenmanager/main/cpp/include/service", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", "${access_token_path}/services/tokensyncmanager/include/command", "${access_token_path}/services/tokensyncmanager/include/common", "${access_token_path}/services/tokensyncmanager/include/device", @@ -99,17 +99,16 @@ access_token_sources = [ "${access_token_path}/services/accesstokenmanager/main/cpp/src/form_manager/form_manager_access_proxy.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/form_manager/form_manager_death_recipient.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/form_manager/form_status_change_callback.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_id_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_info_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/hap_token_info_inner.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_data_brief.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_grant_event.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/permission_validator.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/short_grant_manager.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/temp_permission_observer.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/seccomp/sec_comp_monitor.cpp", "${access_token_path}/services/accesstokenmanager/main/cpp/src/service/accesstoken_manager_service.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_id_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_info_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/hap_token_info_inner.cpp", ] token_sync_sources = [ @@ -150,8 +149,8 @@ if (token_sync_enable == true) { "-DFUZZ_ENABLE", ] access_token_sources += [ - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/accesstoken_remote_token_manager.cpp", - "${access_token_path}/services/accesstokenmanager/main/cpp/src/token/token_modify_notifier.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/accesstoken_remote_token_manager.cpp", + "${access_token_path}/services/accesstokenmanager/main/cpp/src/permission/token_modify_notifier.cpp", "${access_token_path}/services/common/libraryloader/src/libraryloader.cpp", ] access_token_include_dirs += [ diff --git a/test/fuzztest/services/privacy/privacy_service_fuzz.gni b/test/fuzztest/services/privacy/privacy_service_fuzz.gni index 805611be2d972a8ab9dacdd1965fabc9b92fbfb3..d9165581e96324abcaad1dc29cee3258c7a8bc86 100644 --- a/test/fuzztest/services/privacy/privacy_service_fuzz.gni +++ b/test/fuzztest/services/privacy/privacy_service_fuzz.gni @@ -38,7 +38,7 @@ privacy_include_dirs = [ "${access_token_path}/services/common/screenlock_manager/include", "${access_token_path}/services/common/utils/include", "${access_token_path}/test/fuzztest/common", - "${access_token_path}/services/accesstokenmanager/main/cpp/include/token", + "${access_token_path}/services/accesstokenmanager/main/cpp/include/permission", ] privacy_deps = [