• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2024 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_SERVICES_BUNDLEMGR_RESOURCE_INFO_H
17 #define FOUNDATION_BUNDLEMANAGER_BUNDLE_FRAMEWORK_SERVICES_BUNDLEMGR_RESOURCE_INFO_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "bundle_resource_info.h"
23 #include "launcher_ability_resource_info.h"
24 namespace OHOS {
25 namespace AppExecFwk {
26 enum class IconResourceType {
27     UNKNOWN = 0,
28     THEME_ICON = 1,
29     DYNAMIC_ICON = 2
30 };
31 class ResourceInfo {
32 public:
33     ResourceInfo();
34     ~ResourceInfo();
35 
36     void ConvertFromBundleResourceInfo(const BundleResourceInfo &bundleResourceInfo);
37 
38     void ConvertFromLauncherAbilityResourceInfo(const LauncherAbilityResourceInfo &launcherAbilityResourceInfo);
39     /**
40      * key:
41      * 1. bundleName
42      * 2. bundleName/moduleName/abilityName
43      */
44     std::string GetKey() const;
45     void ParseKey(const std::string &key);
46     bool labelNeedParse_ = true;
47     bool iconNeedParse_ = true;
48     // label resource
49     uint32_t labelId_ = 0;
50     // icon resource
51     uint32_t iconId_ = 0;
52     // for app clone
53     int32_t appIndex_ = 0;
54     int32_t extensionAbilityType_ = -1;
55     // key
56     std::string bundleName_;
57     std::string moduleName_;
58     std::string abilityName_;
59     std::string label_;
60     std::string icon_;
61     // used for parse label and icon
62     std::string hapPath_;
63     // used for parse overlay label and icon
64     std::vector<std::string> overlayHapPaths_;
65     // used for layer icons
66     std::vector<uint8_t> foreground_;
67     std::vector<uint8_t> background_;
68     std::vector<int32_t> appIndexes_;
69 
70 private:
71     void InnerParseAppIndex(const std::string &key);
72 };
73 } // AppExecFwk
74 } // OHOS
75 #endif // FOUNDATION_BUNDLEMANAGER_BUNDLE_FRAMEWORK_SERVICES_BUNDLEMGR_RESOURCE_INFO_H
76