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_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 class ResourceInfo { 27 public: 28 ResourceInfo(); 29 ~ResourceInfo(); 30 31 void ConvertFromBundleResourceInfo(const BundleResourceInfo &bundleResourceInfo); 32 33 void ConvertFromLauncherAbilityResourceInfo(const LauncherAbilityResourceInfo &launcherAbilityResourceInfo); 34 /** 35 * key: 36 * 1. bundleName 37 * 2. bundleName/moduleName/abilityName 38 */ 39 std::string GetKey() const; 40 void ParseKey(const std::string &key); 41 // key 42 std::string bundleName_; 43 std::string moduleName_; 44 std::string abilityName_; 45 // label resource 46 uint32_t labelId_ = 0; 47 std::string label_; 48 bool labelNeedParse_ = true; 49 // icon resource 50 uint32_t iconId_ = 0; 51 std::string icon_; 52 bool iconNeedParse_ = true; 53 // used for parse label and icon 54 std::string hapPath_; 55 // used for parse overlay label and icon 56 std::vector<std::string> overlayHapPaths_; 57 // used for layer icons 58 std::vector<uint8_t> foreground_; 59 std::vector<uint8_t> background_; 60 // for app clone 61 int32_t appIndex_ = 0; 62 std::vector<int32_t> appIndexes_; 63 64 private: 65 void InnerParseAppIndex(const std::string &key); 66 }; 67 } // AppExecFwk 68 } // OHOS 69 #endif // FOUNDATION_BUNDLEMANAGER_BUNDLE_FRAMEWORK_SERVICES_BUNDLEMGR_RESOURCE_INFO_H 70