1600cc4afSopenharmony_ci/* 2600cc4afSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 3600cc4afSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4600cc4afSopenharmony_ci * you may not use this file except in compliance with the License. 5600cc4afSopenharmony_ci * You may obtain a copy of the License at 6600cc4afSopenharmony_ci * 7600cc4afSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8600cc4afSopenharmony_ci * 9600cc4afSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10600cc4afSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11600cc4afSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12600cc4afSopenharmony_ci * See the License for the specific language governing permissions and 13600cc4afSopenharmony_ci * limitations under the License. 14600cc4afSopenharmony_ci */ 15600cc4afSopenharmony_ci 16600cc4afSopenharmony_ci#ifndef FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_HIDUMPE_HELPER_H 17600cc4afSopenharmony_ci#define FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_HIDUMPE_HELPER_H 18600cc4afSopenharmony_ci 19600cc4afSopenharmony_ci#include <string> 20600cc4afSopenharmony_ci#include <vector> 21600cc4afSopenharmony_ci 22600cc4afSopenharmony_ci#include "bundle_data_mgr.h" 23600cc4afSopenharmony_ci 24600cc4afSopenharmony_cinamespace OHOS { 25600cc4afSopenharmony_cinamespace AppExecFwk { 26600cc4afSopenharmony_cienum class HidumpFlag : uint8_t { 27600cc4afSopenharmony_ci UNKNOW = 0, 28600cc4afSopenharmony_ci GET_HELP, 29600cc4afSopenharmony_ci GET_ABILITY, 30600cc4afSopenharmony_ci GET_ABILITY_LIST, 31600cc4afSopenharmony_ci GET_ABILITY_BY_NAME, 32600cc4afSopenharmony_ci GET_BUNDLE, 33600cc4afSopenharmony_ci GET_BUNDLE_LIST, 34600cc4afSopenharmony_ci GET_BUNDLE_BY_NAME, 35600cc4afSopenharmony_ci GET_DEVICEID, 36600cc4afSopenharmony_ci}; 37600cc4afSopenharmony_ci 38600cc4afSopenharmony_cistruct HidumpParam { 39600cc4afSopenharmony_ci HidumpFlag hidumpFlag = HidumpFlag::UNKNOW; 40600cc4afSopenharmony_ci std::string args; 41600cc4afSopenharmony_ci}; 42600cc4afSopenharmony_ci 43600cc4afSopenharmony_ciclass HidumpHelper { 44600cc4afSopenharmony_cipublic: 45600cc4afSopenharmony_ci explicit HidumpHelper(const std::weak_ptr<BundleDataMgr> &dataMgr); 46600cc4afSopenharmony_ci ~HidumpHelper() = default; 47600cc4afSopenharmony_ci /** 48600cc4afSopenharmony_ci * @brief Process hidump. 49600cc4afSopenharmony_ci * @param args Indicates the args. 50600cc4afSopenharmony_ci * @param result Indicates the result. 51600cc4afSopenharmony_ci * @return Returns whether the interface is called successfully. 52600cc4afSopenharmony_ci */ 53600cc4afSopenharmony_ci bool Dump(const std::vector<std::string>& args, std::string &result); 54600cc4afSopenharmony_ci 55600cc4afSopenharmony_ciprivate: 56600cc4afSopenharmony_ci ErrCode ProcessOneParam(const std::string& args, std::string &result); 57600cc4afSopenharmony_ci ErrCode ProcessTwoParam(const std::string& firstParam, 58600cc4afSopenharmony_ci const std::string& secondParam, std::string &result); 59600cc4afSopenharmony_ci void ShowHelp(std::string &result); 60600cc4afSopenharmony_ci void ShowIllealInfomation(std::string &result); 61600cc4afSopenharmony_ci ErrCode ProcessDump(const HidumpParam& hidumpParam, std::string &result); 62600cc4afSopenharmony_ci 63600cc4afSopenharmony_ci ErrCode GetAllAbilityInfo(std::string &result); 64600cc4afSopenharmony_ci ErrCode GetAllAbilityNameList(std::string &result); 65600cc4afSopenharmony_ci ErrCode GetAbilityInfoByName(const std::string &name, std::string &result); 66600cc4afSopenharmony_ci ErrCode GetAllBundleInfo(std::string &result); 67600cc4afSopenharmony_ci ErrCode GetAllBundleNameList(std::string &result); 68600cc4afSopenharmony_ci ErrCode GetBundleInfoByName(const std::string &name, std::string &result); 69600cc4afSopenharmony_ci ErrCode GetAllDeviced(std::string &result); 70600cc4afSopenharmony_ci 71600cc4afSopenharmony_ci std::weak_ptr<BundleDataMgr> dataMgr_; 72600cc4afSopenharmony_ci}; 73600cc4afSopenharmony_ci} // namespace AppExecFwk 74600cc4afSopenharmony_ci} // namespace OHOS 75600cc4afSopenharmony_ci#endif // FOUNDATION_APPEXECFWK_SERVICES_BUNDLEMGR_INCLUDE_HIDUMPE_HELPER_H 76