diff --git a/frameworks/include/bundle_command.h b/frameworks/include/bundle_command.h index 4625b142f2c2739a139c8cadd7af86dc030d648d..88369d27ad09b64479d18fb9b99df593dd7a7f8d 100644 --- a/frameworks/include/bundle_command.h +++ b/frameworks/include/bundle_command.h @@ -42,6 +42,20 @@ const std::string HELP_MSG = "usage: bm \n" " dump-dependencies dump dependencies by given bundle name and module name\n" " dump-shared dump inter-application shared library information by bundle name\n"; +const std::string HELP_MSG_USER_MODE = "usage: bm \n" + "These are common bm commands list:\n" + " help list available commands\n" + " install install a bundle with options\n" + " uninstall uninstall a bundle with options\n" + " dump dump the bundle info\n" + " get obtain device udid\n" + " quickfix quick fix, including query and install\n" + " compile Compile the software package\n" + " dump-overlay dump overlay info of the specific overlay bundle\n" + " dump-target-overlay dump overlay info of the specific target bundle\n" + " dump-dependencies dump dependencies by given bundle name and module name\n" + " dump-shared dump inter-application shared library information by bundle name\n"; + const std::string HELP_MSG_COMPILE = "usage: bm compile [-m mode] [-r reset] (bundle-name | -a)\n" "options list:\n" diff --git a/frameworks/src/bundle_command.cpp b/frameworks/src/bundle_command.cpp index 46b81ec1d007fc27d8fb6b38fa22c3beba1c94de..fe760bd7be1cbfebe9b40e68494cd1cadfaaac0f 100644 --- a/frameworks/src/bundle_command.cpp +++ b/frameworks/src/bundle_command.cpp @@ -45,6 +45,7 @@ const std::string OVERLAY_BUNDLE_INFOS = "overlayBundleInfos"; const std::string OVERLAY_MODULE_INFO = "overlayModuleInfo"; const std::string SHARED_BUNDLE_INFO = "sharedBundleInfo"; const std::string DEPENDENCIES = "dependencies"; +const char* IS_ROOT_MODE_PARAM = "const.debuggable"; const int32_t INDEX_OFFSET = 2; const int32_t MAX_WAITING_TIME = 3000; const int32_t DEVICE_UDID_LENGTH = 65; @@ -234,7 +235,11 @@ ErrCode BundleManagerShellCommand::Init() ErrCode BundleManagerShellCommand::RunAsHelpCommand() { - resultReceiver_.append(HELP_MSG); + if (GetIntParameter(IS_ROOT_MODE_PARAM, false)) { + resultReceiver_.append(HELP_MSG); + } else { + resultReceiver_.append(HELP_MSG_USER_MODE); + } return OHOS::ERR_OK; } @@ -933,6 +938,11 @@ ErrCode BundleManagerShellCommand::RunAsDumpCommand() ErrCode BundleManagerShellCommand::RunAsCleanCommand() { + if (!GetIntParameter(IS_ROOT_MODE_PARAM, false)) { + APP_LOGD("in user mode"); + return ERR_OK; + } + APP_LOGI("begin to RunAsCleanCommand"); int32_t result = OHOS::ERR_OK; int32_t counter = 0; @@ -1081,6 +1091,10 @@ ErrCode BundleManagerShellCommand::RunAsCleanCommand() ErrCode BundleManagerShellCommand::RunAsEnableCommand() { + if (!GetIntParameter(IS_ROOT_MODE_PARAM, false)) { + APP_LOGD("in user mode"); + return ERR_OK; + } APP_LOGI("begin to RunAsEnableCommand"); int result = OHOS::ERR_OK; int counter = 0; @@ -1216,6 +1230,10 @@ ErrCode BundleManagerShellCommand::RunAsEnableCommand() ErrCode BundleManagerShellCommand::RunAsDisableCommand() { + if (!GetIntParameter(IS_ROOT_MODE_PARAM, false)) { + APP_LOGD("in user mode"); + return ERR_OK; + } APP_LOGI("begin to RunAsDisableCommand"); int result = OHOS::ERR_OK; int counter = 0;