From 60beff495ebb44b451511e47ab45a5bcb21c4760 Mon Sep 17 00:00:00 2001 From: chennian Date: Thu, 15 May 2025 13:20:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=93=9D=E9=BB=84=E5=B7=AE=E5=BC=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chennian Change-Id: Icd3604ecabb6f77ea09fc4a7075e66306595a3c5 --- .../accesstoken/test/unittest/BUILD.gn | 5 +-- .../request_permission_on_setting_test.cpp | 6 ++-- .../include/active_change_response_info.h | 2 +- .../innerkits/privacy/include/privacy_error.h | 2 +- interfaces/innerkits/tokensync/BUILD.gn | 2 +- services/accesstokenmanager/BUILD.gn | 1 - .../cpp/src/database/access_token_db_util.cpp | 2 -- .../src/permission/short_grant_manager.cpp | 8 ++--- .../accesstokenmanager/test/coverage/BUILD.gn | 1 - .../accesstokenmanager/test/mock/BUILD.gn | 1 - .../accesstokenmanager/test/unittest/BUILD.gn | 1 - .../include/record/permission_record_config.h | 35 ------------------- 12 files changed, 11 insertions(+), 55 deletions(-) delete mode 100644 services/privacymanager/include/record/permission_record_config.h diff --git a/interfaces/innerkits/accesstoken/test/unittest/BUILD.gn b/interfaces/innerkits/accesstoken/test/unittest/BUILD.gn index b30273ac1..256106b24 100755 --- a/interfaces/innerkits/accesstoken/test/unittest/BUILD.gn +++ b/interfaces/innerkits/accesstoken/test/unittest/BUILD.gn @@ -102,10 +102,7 @@ ohos_unittest("libaccesstoken_sdk_test") { ] if (token_sync_enable == true) { cflags_cc += [ "-DTOKEN_SYNC_ENABLE" ] - external_deps += [ - "device_manager:devicemanagersdk", - "json:nlohmann_json_static", - ] + external_deps += [ "device_manager:devicemanagersdk" ] } if (dlp_permission_enable == true) { cflags_cc += [ "-DSUPPORT_SANDBOX_APP" ] diff --git a/interfaces/innerkits/accesstoken/test/unittest/PermisionDialogTest/request_permission_on_setting_test.cpp b/interfaces/innerkits/accesstoken/test/unittest/PermisionDialogTest/request_permission_on_setting_test.cpp index 66a33771f..d3a0dfb5b 100644 --- a/interfaces/innerkits/accesstoken/test/unittest/PermisionDialogTest/request_permission_on_setting_test.cpp +++ b/interfaces/innerkits/accesstoken/test/unittest/PermisionDialogTest/request_permission_on_setting_test.cpp @@ -77,7 +77,7 @@ HWTEST_F(RequestPermissionOnSettingTest, RequestAppPermOnSettingTest001, TestSiz HWTEST_F(RequestPermissionOnSettingTest, RequestAppPermOnSettingTest002, TestSize.Level0) { std::vector reqPerm; - MockHapToken("RequestAppPermOnSettingTest002", reqPerm, false); + MockHapToken mock("RequestAppPermOnSettingTest002", reqPerm, false); AccessTokenID tokenID = 123; ASSERT_EQ(ERR_NOT_SYSTEM_APP, AccessTokenKit::RequestAppPermOnSetting(tokenID)); @@ -92,7 +92,7 @@ HWTEST_F(RequestPermissionOnSettingTest, RequestAppPermOnSettingTest002, TestSiz HWTEST_F(RequestPermissionOnSettingTest, RequestAppPermOnSettingTest003, TestSize.Level0) { std::vector reqPerm; - MockHapToken("RequestAppPermOnSettingTest003", reqPerm, true); + MockHapToken mock("RequestAppPermOnSettingTest003", reqPerm, true); HapInfoParams infoManager = { .userID = 1, @@ -133,7 +133,7 @@ HWTEST_F(RequestPermissionOnSettingTest, RequestAppPermOnSettingTest003, TestSiz HWTEST_F(RequestPermissionOnSettingTest, RequestAppPermOnSettingTest004, TestSize.Level0) { std::vector reqPerm; - MockHapToken("RequestAppPermOnSettingTest004", reqPerm, true); + MockHapToken mock("RequestAppPermOnSettingTest004", reqPerm, true); AccessTokenKit::RequestAppPermOnSetting(GetSelfTokenID()); } diff --git a/interfaces/innerkits/privacy/include/active_change_response_info.h b/interfaces/innerkits/privacy/include/active_change_response_info.h index b8a148965..ef6d349f0 100644 --- a/interfaces/innerkits/privacy/include/active_change_response_info.h +++ b/interfaces/innerkits/privacy/include/active_change_response_info.h @@ -51,7 +51,7 @@ enum ActiveChangeType { PERM_INACTIVE = 0, PERM_ACTIVE_IN_FOREGROUND = 1, PERM_ACTIVE_IN_BACKGROUND = 2, - PERM_TEMPORARY_CALL, + PERM_TEMPORARY_CALL = 3, }; /** diff --git a/interfaces/innerkits/privacy/include/privacy_error.h b/interfaces/innerkits/privacy/include/privacy_error.h index d1b622338..dc98690a6 100644 --- a/interfaces/innerkits/privacy/include/privacy_error.h +++ b/interfaces/innerkits/privacy/include/privacy_error.h @@ -63,8 +63,8 @@ enum PrivacyError { ERR_EDM_POLICY_CHECK_FAILED, ERR_PRIVACY_POLICY_CHECK_FAILED, ERR_REMOTE_CONNECTION, - ERR_ADD_DEATH_RECIPIENT_FAILED, ERR_FIRST_CALLER_NOT_EDM, + ERR_ADD_DEATH_RECIPIENT_FAILED, PRIVACY_TOGGELE_RESTRICTED, }; } // namespace AccessToken diff --git a/interfaces/innerkits/tokensync/BUILD.gn b/interfaces/innerkits/tokensync/BUILD.gn index 4053b2bf1..f9bc463a8 100644 --- a/interfaces/innerkits/tokensync/BUILD.gn +++ b/interfaces/innerkits/tokensync/BUILD.gn @@ -38,7 +38,7 @@ if (is_standard_system) { "${access_token_path}/frameworks/common/include", "${access_token_path}/frameworks/tokensync/include", "${access_token_path}/interfaces/innerkits/accesstoken/include", - "${access_token_path}/interfaces/innerkits/tokensync/include", + "include", "src", ] diff --git a/services/accesstokenmanager/BUILD.gn b/services/accesstokenmanager/BUILD.gn index 7d5f3bbd0..6a9884450 100644 --- a/services/accesstokenmanager/BUILD.gn +++ b/services/accesstokenmanager/BUILD.gn @@ -120,7 +120,6 @@ if (is_standard_system) { "${access_token_path}/frameworks/accesstoken:accesstoken_communication_adapter_cxx", "${access_token_path}/frameworks/common:accesstoken_common_cxx", "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk", - "${access_token_path}/interfaces/innerkits/privacy:libprivacy_sdk", "${access_token_path}/interfaces/innerkits/token_setproc:libperm_setproc", "${access_token_path}/interfaces/innerkits/token_setproc:libtoken_setproc", "${access_token_path}/services/accesstokenmanager:access_token.rc", diff --git a/services/accesstokenmanager/main/cpp/src/database/access_token_db_util.cpp b/services/accesstokenmanager/main/cpp/src/database/access_token_db_util.cpp index 21b3d9c3a..7b47a11e7 100644 --- a/services/accesstokenmanager/main/cpp/src/database/access_token_db_util.cpp +++ b/services/accesstokenmanager/main/cpp/src/database/access_token_db_util.cpp @@ -17,8 +17,6 @@ #include -#include "token_field_const.h" - namespace OHOS { namespace Security { namespace AccessToken { diff --git a/services/accesstokenmanager/main/cpp/src/permission/short_grant_manager.cpp b/services/accesstokenmanager/main/cpp/src/permission/short_grant_manager.cpp index 5f7f120ec..0dcb9012b 100644 --- a/services/accesstokenmanager/main/cpp/src/permission/short_grant_manager.cpp +++ b/services/accesstokenmanager/main/cpp/src/permission/short_grant_manager.cpp @@ -165,13 +165,13 @@ int ShortGrantManager::RefreshPermission(AccessTokenID tokenID, const std::strin return RET_SUCCESS; } - uint32_t maxRemainedTime = maxTime_ - (GetCurrentTime() - iter->firstGrantTimes); - uint32_t currRemainedTime = iter->revokeTimes > GetCurrentTime() ? (iter->revokeTimes - GetCurrentTime()) : 0; + uint32_t maxRemainedTime = maxTime_ > (GetCurrentTime() - iter->firstGrantTimes) ? + (maxTime_ - (GetCurrentTime() - iter->firstGrantTimes)) : 0; + uint32_t currRemainedTime = iter->revokeTimes > GetCurrentTime() ? + (iter->revokeTimes - GetCurrentTime()) : 0; uint32_t cancelTimes = (maxRemainedTime > onceTime) ? onceTime : maxRemainedTime; - LOGI(ATM_DOMAIN, ATM_TAG, "currRemainedTime %{public}d", currRemainedTime); if (cancelTimes > currRemainedTime) { iter->revokeTimes = GetCurrentTime() + cancelTimes; - LOGI(ATM_DOMAIN, ATM_TAG, "iter->revokeTimes %{public}d", iter->revokeTimes); ShortGrantManager::GetInstance().CancelTaskOfPermissionRevoking(taskName); int32_t ret = PermissionManager::GetInstance().GrantPermission(tokenID, permission, PERMISSION_USER_FIXED); if (ret != RET_SUCCESS) { diff --git a/services/accesstokenmanager/test/coverage/BUILD.gn b/services/accesstokenmanager/test/coverage/BUILD.gn index ecc13840b..81459e576 100644 --- a/services/accesstokenmanager/test/coverage/BUILD.gn +++ b/services/accesstokenmanager/test/coverage/BUILD.gn @@ -98,7 +98,6 @@ ohos_unittest("libaccesstoken_manager_service_coverage_test") { "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk", "${access_token_path}/interfaces/innerkits/nativetoken:libnativetoken_shared", - "${access_token_path}/interfaces/innerkits/privacy:libprivacy_sdk", "${access_token_path}/interfaces/innerkits/token_setproc:libperm_setproc", "${access_token_path}/interfaces/innerkits/token_setproc:libtokensetproc_shared", "${access_token_path}/services/accesstokenmanager/idl:access_token_manager_stub", diff --git a/services/accesstokenmanager/test/mock/BUILD.gn b/services/accesstokenmanager/test/mock/BUILD.gn index 4accc53c0..3f7f01a45 100644 --- a/services/accesstokenmanager/test/mock/BUILD.gn +++ b/services/accesstokenmanager/test/mock/BUILD.gn @@ -99,7 +99,6 @@ ohos_unittest("libpermission_manager_mock_test") { "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk", "${access_token_path}/interfaces/innerkits/nativetoken:libnativetoken_shared", - "${access_token_path}/interfaces/innerkits/privacy:libprivacy_sdk", "${access_token_path}/interfaces/innerkits/token_setproc:libperm_setproc", "${access_token_path}/interfaces/innerkits/token_setproc:libtokensetproc_shared", "${access_token_path}/services/accesstokenmanager/idl:access_token_manager_stub", diff --git a/services/accesstokenmanager/test/unittest/BUILD.gn b/services/accesstokenmanager/test/unittest/BUILD.gn index 1074f025e..85fb1f6fb 100644 --- a/services/accesstokenmanager/test/unittest/BUILD.gn +++ b/services/accesstokenmanager/test/unittest/BUILD.gn @@ -112,7 +112,6 @@ ohos_unittest("libaccesstoken_manager_service_standard_test") { "${access_token_path}/interfaces/innerkits/accesstoken:libaccesstoken_sdk", "${access_token_path}/interfaces/innerkits/accesstoken:libtokenid_sdk", "${access_token_path}/interfaces/innerkits/nativetoken:libnativetoken_shared", - "${access_token_path}/interfaces/innerkits/privacy:libprivacy_sdk", "${access_token_path}/interfaces/innerkits/token_setproc:libperm_setproc", "${access_token_path}/interfaces/innerkits/token_setproc:libtokensetproc_shared", "${access_token_path}/services/accesstokenmanager/idl:access_token_manager_stub", diff --git a/services/privacymanager/include/record/permission_record_config.h b/services/privacymanager/include/record/permission_record_config.h deleted file mode 100644 index c0b82481a..000000000 --- a/services/privacymanager/include/record/permission_record_config.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 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. - */ - -#ifndef INTERFACES_INNER_KITS_ACCESSTOKEN_PERMISSION_RECORD_CONFIG_H -#define INTERFACES_INNER_KITS_ACCESSTOKEN_PERMISSION_RECORD_CONFIG_H - -#include - -namespace OHOS { -namespace Security { -namespace AccessToken { -class PermissionRecordConfig final { -public: - int32_t sizeMaxImum; - int32_t agingTime; - std::string globalDialogBundleName; - std::string globalDialogAbilityName; -}; -} // namespace AccessToken -} // namespace Security -} // namespace OHOS - -#endif // INTERFACES_INNER_KITS_ACCESSTOKEN_PERMISSION_RECORD_CONFIG_H -- Gitee