1 /* 2 * Copyright (c) 2020-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 OHOS_GT_BUNDLE_EXTRACTOR_H 17 #define OHOS_GT_BUNDLE_EXTRACTOR_H 18 19 #include "bundle_common.h" 20 #include "stdint.h" 21 22 namespace OHOS { 23 class GtBundleExtractor { 24 public: 25 static uint8_t ExtractHap(const char *codePath, const char *bundleName, int32_t fp, uint32_t totalFileSize, 26 uint8_t bundleStyle); 27 static char *ExtractHapProfile(int32_t fp, uint32_t totalFileSize); 28 static uint8_t ExtractBundleParam(const char *path, int32_t &fpStart, char **bundleName); 29 static uint8_t ExtractInstallMsg(const char *path, char **bundleName, char **label, char **smallIconPath, 30 char **bigIconPath, uint8_t &actionService); 31 static uint8_t ParseBundleInfoGetActionService(const char *bundleName); 32 33 private: 34 static uint8_t ExtractFileDataPos(int32_t fp, uint64_t &filePos); 35 static bool ExtractResourceFile(const char *path, int32_t fp, uint32_t totalFileSize); 36 static uint8_t FindSkillService(AbilityInfo *abilityInfo); 37 static uint8_t CompareStringArray(char *actions[], int count); 38 }; 39 } // namespace OHOS 40 #endif // OHOS_GT_BUNDLE_EXTRACTOR_H