• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 FOUNDATION_BUNDLEMANAGER_BUNDLE_FRAMEWORK_SERVICE_BUNDLEMGR_INCLUDE_VERIFY_VERIFY_MANAGER_PROXY_H
17 #define FOUNDATION_BUNDLEMANAGER_BUNDLE_FRAMEWORK_SERVICE_BUNDLEMGR_INCLUDE_VERIFY_VERIFY_MANAGER_PROXY_H
18 
19 #include "verify_manager_host.h"
20 
21 namespace OHOS {
22 namespace AppExecFwk {
23 class VerifyManagerHostImpl : public VerifyManagerHost {
24 public:
25     VerifyManagerHostImpl();
26     virtual ~VerifyManagerHostImpl();
27 
28     ErrCode Verify(const std::vector<std::string> &abcPaths,
29         const std::vector<std::string> &abcNames, bool flag) override;
30 
31     ErrCode CreateFd(const std::string &fileName, int32_t &fd, std::string &path) override;
32     ErrCode DeleteAbc(const std::string &path) override;
33 
34 private:
35     ErrCode InnerVerify(const std::vector<std::string> &abcPaths,
36         const std::vector<std::string> &abcNames, bool flag);
37     bool VerifyAbc(const std::vector<std::string> &abcPaths);
38     bool MoveAbc(const std::vector<std::string> &abcPaths,
39         const std::vector<std::string> &abcNames, const std::string &pathDir);
40     void Rollback(const std::vector<std::string> &paths);
41     bool GetFileName(const std::string &sourcePath, std::string &fileName);
42     bool GetFileDir(const std::string &sourcePath, std::string &fileDir);
43     void RemoveTempFiles(const std::vector<std::string> &paths);
44     bool VerifyAbc(
45         const std::string &rootDir, const std::vector<std::string> &names);
46     bool CheckFileParam(
47         const std::vector<std::string> &abcPaths, const std::vector<std::string> &abcNames);
48     void Rollback(const std::string &rootDir, const std::vector<std::string> &names);
49     ErrCode MkdirIfNotExist(const std::string &dir);
50 
51     std::atomic<uint32_t> id_ = 0;
52 };
53 } // AppExecFwk
54 } // OHOS
55 #endif // FOUNDATION_BUNDLEMANAGER_BUNDLE_FRAMEWORK_SERVICE_BUNDLEMGR_INCLUDE_VERIFY_VERIFY_MANAGER_PROXY_H
56