diff --git a/frameworks/include/bundle_command.h b/frameworks/include/bundle_command.h index 742a2fb0933c42db8c5248227baa49ed6edbc711..7208e5f92ec0babbb7238c6c5775bf8db7f2d543 100644 --- a/frameworks/include/bundle_command.h +++ b/frameworks/include/bundle_command.h @@ -122,6 +122,7 @@ const std::string HELP_MSG_QUICK_FIX = "-h, --help list available commands\n" "-q, --query indicates query quickfix, used with -b or --bundle-name\n" "-b, --bundle-name query quickfix status and information by a specified bundle name\n" + "-d, --debug query quickfix debug mode\n" "-a, --apply indicates apply quickfix, used with -f or --file-path\n" "-f, --file-path apply a quickfix file by a specified path\n" "-f, --file-path ... apply some quickfix files of one bundle\n" diff --git a/frameworks/include/quick_fix_command.h b/frameworks/include/quick_fix_command.h index 7f3c0d64793dfefc3cea70e91ec67103c73640f0..3fcaf7baee445ca509166e4d7e5a4dbd0b3b36c0 100644 --- a/frameworks/include/quick_fix_command.h +++ b/frameworks/include/quick_fix_command.h @@ -24,7 +24,8 @@ namespace OHOS { namespace AppExecFwk { class QuickFixCommand { public: -static int32_t ApplyQuickFix(const std::vector &quickFixFiles, std::string &resultInfo); +static int32_t ApplyQuickFix(const std::vector &quickFixFiles, std::string &resultInfo, + bool isDebug = false); static int32_t GetApplyedQuickFixInfo(const std::string &bundleName, std::string &resultInfo); static std::string GetQuickFixInfoString(const AAFwk::ApplicationQuickFixInfo &quickFixInfo); }; diff --git a/frameworks/src/bundle_command.cpp b/frameworks/src/bundle_command.cpp index c2eb6ed77be87c0005f398a2bab414e6534b0b47..be82ded054396b90db40a40faf75fee65dd76618 100644 --- a/frameworks/src/bundle_command.cpp +++ b/frameworks/src/bundle_command.cpp @@ -21,7 +21,7 @@ #include #include #include - +#include #include "app_log_wrapper.h" #include "appexecfwk_errors.h" #include "bundle_command_common.h" @@ -1337,6 +1337,7 @@ ErrCode BundleManagerShellCommand::RunAsQuickFixCommand() index++; if (argKey == "-f" || argKey == "--file-path") { std::vector quickFixFiles; + bool isDebug = false; // collect value of multi file-path. for (; index < argc_ && index >= INDEX_OFFSET; ++index) { if (argList_[index - INDEX_OFFSET] == "-q" || argList_[index - INDEX_OFFSET] == "--query" || @@ -1344,11 +1345,14 @@ ErrCode BundleManagerShellCommand::RunAsQuickFixCommand() argList_[index - INDEX_OFFSET] == "-a" || argList_[index - INDEX_OFFSET] == "--apply" || argList_[index - INDEX_OFFSET] == "-f" || argList_[index - INDEX_OFFSET] == "--file-path") { break; + } else if (argList_[index - INDEX_OFFSET] == "-d" || argList_[index - INDEX_OFFSET] == "--debug") { + std::istringstream(argList_[++index - INDEX_OFFSET]) >> std::boolalpha >> isDebug; + break; } quickFixFiles.emplace_back(argList_[index - INDEX_OFFSET]); } - return QuickFixCommand::ApplyQuickFix(quickFixFiles, resultReceiver_); + return QuickFixCommand::ApplyQuickFix(quickFixFiles, resultReceiver_, isDebug); } } else if ((opt == "-q") || (opt == "--query")) { if (index >= argc_ - INDEX_OFFSET) { diff --git a/frameworks/src/quick_fix_command.cpp b/frameworks/src/quick_fix_command.cpp index 86fa3c40aaddcb2090e9075585004239b6c9fd2e..b664cd416c6236b5166cddf15c4c155f97d47b36 100644 --- a/frameworks/src/quick_fix_command.cpp +++ b/frameworks/src/quick_fix_command.cpp @@ -57,7 +57,8 @@ private: std::string resultInfo_; }; -int32_t QuickFixCommand::ApplyQuickFix(const std::vector &quickFixFiles, std::string &resultInfo) +int32_t QuickFixCommand::ApplyQuickFix(const std::vector &quickFixFiles, std::string &resultInfo, + bool isDebug) { if (quickFixFiles.empty()) { resultInfo.append("quick fix file is empty.\n"); @@ -68,6 +69,12 @@ int32_t QuickFixCommand::ApplyQuickFix(const std::vector &quickFixF APP_LOGI("apply hqf file %{private}s.", file.c_str()); } + if (isDebug == true) { + APP_LOGI("isDebug is true"); + } else { + APP_LOGI("isDebug is false"); + } + sptr statusReceiver(new (std::nothrow) StatusReceiverImpl()); if (statusReceiver == nullptr) { resultInfo.append("Create status receiver failed.\n"); @@ -80,7 +87,7 @@ int32_t QuickFixCommand::ApplyQuickFix(const std::vector &quickFixF auto applyMonitor = std::make_shared(subscribeInfo, statusReceiver); EventFwk::CommonEventManager::SubscribeCommonEvent(applyMonitor); - auto result = DelayedSingleton::GetInstance()->ApplyQuickFix(quickFixFiles); + auto result = DelayedSingleton::GetInstance()->ApplyQuickFix(quickFixFiles, isDebug); if (result == ERR_OK) { APP_LOGD("Waiting apply finished."); result = statusReceiver->GetResultCode();