• 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_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BUNDLE_OVERLAY_INSTALL_CHECKER_H
17 #define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BUNDLE_OVERLAY_INSTALL_CHECKER_H
18 
19 #include <map>
20 #include <string>
21 
22 #include "inner_bundle_info.h"
23 
24 namespace OHOS {
25 namespace AppExecFwk {
26 class BundleOverlayInstallChecker final {
27 public:
28     BundleOverlayInstallChecker() = default;
29     virtual ~BundleOverlayInstallChecker() = default;
30 
31     ErrCode CheckInternalBundle(const std::unordered_map<std::string, InnerBundleInfo> &newInfos,
32         const InnerBundleInfo &innerBundleInfo) const;
33     ErrCode CheckExternalBundle(const InnerBundleInfo &innerBundleInfo, int32_t userId) const;
34     ErrCode CheckTargetBundle(const std::string &targetBundleName, const std::string &targetModuleName,
35         const std::string &fingerprint, int32_t userId) const;
36 
37 private:
38     ErrCode CheckHapType(const InnerBundleInfo &info) const;
39     ErrCode CheckBundleType(const InnerBundleInfo &info) const;
40     ErrCode CheckTargetPriority(int32_t priority) const;
41     ErrCode CheckVersionCode(const std::unordered_map<std::string, InnerBundleInfo> &newInfos,
42         const InnerBundleInfo &info) const;
43     ErrCode CheckTargetModule(const std::string &bundleName, const std::string &targetModuleName) const;
44 };
45 } // AppExecFwk
46 } // OHOS
47 #endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_BUNDLE_OVERLAY_INSTALL_CHECKER_H