1 /* 2 * Copyright (c) 2025 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 FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_VERIFY_MANAGER_CLIENT_H 17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_VERIFY_MANAGER_CLIENT_H 18 19 #include <mutex> 20 21 #include "appexecfwk_errors.h" 22 #include "bundle_info.h" 23 #include "bundle_mgr_interface.h" 24 #include "iverify_manager.h" 25 26 namespace OHOS { 27 namespace AppExecFwk { 28 class VerifyManagerClient { 29 public: 30 static VerifyManagerClient &GetInstance(); 31 32 ErrCode Verify(const std::vector<std::string>& abcPaths); 33 ErrCode RemoveFiles(const std::vector<std::string>& abcPaths); 34 ErrCode DeleteAbc(const std::string& path); 35 36 private: 37 VerifyManagerClient(); 38 ~VerifyManagerClient(); 39 DISALLOW_COPY_AND_MOVE(VerifyManagerClient); 40 41 class VerifyManagerDeathRecipient : public IRemoteObject::DeathRecipient { 42 public: 43 VerifyManagerDeathRecipient() = default; 44 ~VerifyManagerDeathRecipient() override = default; 45 void OnRemoteDied(const wptr<IRemoteObject>& remote) override; 46 47 private: 48 DISALLOW_COPY_AND_MOVE(VerifyManagerDeathRecipient); 49 }; 50 void ResetVerifyManagerProxy(const wptr<IRemoteObject>& remote); 51 sptr<IVerifyManager> GetVerifyManagerProxy(); 52 53 std::mutex mutex_; 54 sptr<IRemoteObject::DeathRecipient> deathRecipient_; 55 sptr<IVerifyManager> verifyManager_; 56 }; 57 } 58 } 59 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_VERIFY_MANAGER_CLIENT_H 60