• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef I_PRIVACY_MANAGER_H
17 #define I_PRIVACY_MANAGER_H
18 
19 #include <string>
20 
21 #include "access_token.h"
22 #include "errors.h"
23 #include "iremote_broker.h"
24 
25 #include "on_permission_used_record_callback.h"
26 #include "privacy_service_ipc_interface_code.h"
27 #include "permission_used_request_parcel.h"
28 #include "permission_used_result_parcel.h"
29 #ifdef SECURITY_COMPONENT_ENHANCE_ENABLE
30 #include "sec_comp_enhance_data_parcel.h"
31 #endif
32 
33 /* SAID:3505 */
34 namespace OHOS {
35 namespace Security {
36 namespace AccessToken {
37 class IPrivacyManager : public IRemoteBroker {
38 public:
39     static const int32_t SA_ID_PRIVACY_MANAGER_SERVICE = 3505;
40 
41     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.security.accesstoken.IPrivacyManager");
42 
43     virtual int32_t AddPermissionUsedRecord(AccessTokenID tokenID, const std::string& permissionName,
44         int32_t successCount, int32_t failCount, bool asyncMode = false) = 0;
45     virtual int32_t StartUsingPermission(AccessTokenID tokenID, const std::string& permissionName) = 0;
46     virtual int32_t StartUsingPermission(AccessTokenID tokenID, const std::string& permissionName,
47         const sptr<IRemoteObject>& callback) = 0;
48     virtual int32_t StopUsingPermission(AccessTokenID tokenID, const std::string& permissionName) = 0;
49     virtual int32_t RemovePermissionUsedRecords(AccessTokenID tokenID, const std::string& deviceID) = 0;
50     virtual int32_t GetPermissionUsedRecords(
51         const PermissionUsedRequestParcel& request, PermissionUsedResultParcel& result) = 0;
52     virtual int32_t GetPermissionUsedRecords(
53         const PermissionUsedRequestParcel& request, const sptr<OnPermissionUsedRecordCallback>& callback) = 0;
54     virtual int32_t RegisterPermActiveStatusCallback(
55         std::vector<std::string>& permList, const sptr<IRemoteObject>& callback) = 0;
56     virtual int32_t UnRegisterPermActiveStatusCallback(const sptr<IRemoteObject>& callback) = 0;
57     virtual bool IsAllowedUsingPermission(AccessTokenID tokenID, const std::string& permissionName) = 0;
58 #ifdef SECURITY_COMPONENT_ENHANCE_ENABLE
59     virtual int32_t RegisterSecCompEnhance(const SecCompEnhanceDataParcel& enhanceParcel) = 0;
60     virtual int32_t DepositSecCompEnhance(const std::vector<SecCompEnhanceDataParcel>& enhanceParcelList) = 0;
61     virtual int32_t RecoverSecCompEnhance(std::vector<SecCompEnhanceDataParcel>& enhanceParcelList) = 0;
62 #endif
63 };
64 } // namespace AccessToken
65 } // namespace Security
66 } // namespace OHOS
67 
68 #endif // I_PRIVACY_MANAGER_H
69