diff --git a/frameworks/src/bundle_command.cpp b/frameworks/src/bundle_command.cpp index 609b7fe93c0b355b8b00a02bbfa64dd6f8ae4558..a43dc9af39f2b7bb191dfb4ebedefd79fe9e74ce 100644 --- a/frameworks/src/bundle_command.cpp +++ b/frameworks/src/bundle_command.cpp @@ -259,8 +259,6 @@ ErrCode BundleManagerShellCommand::CreateCommandMap() {"uninstall-plugin", [this] { return this->RunAsUninstallPluginCommand(); } }, {"dump", [this] { return this->RunAsDumpCommand(); } }, {"clean", [this] { return this->RunAsCleanCommand(); } }, - {"enable", [this] { return this->RunAsEnableCommand(); } }, - {"disable", [this] { return this->RunAsDisableCommand(); } }, {"get", [this] { return this->RunAsGetCommand(); } }, {"quickfix", [this] { return this->RunAsQuickFixCommand(); } }, {"compile", [this] { return this->RunAsCompileCommand(); } }, @@ -271,6 +269,12 @@ ErrCode BundleManagerShellCommand::CreateCommandMap() {"dump-shared", [this] { return this->RunAsDumpSharedCommand(); } }, }; + int32_t mode = GetIntParameter(IS_ROOT_MODE_PARAM, USER_MODE); + if (mode == ROOT_MODE) { + commandMap_.emplace("enable", [this] { return this->RunAsEnableCommand(); }); + commandMap_.emplace("disable", [this] { return this->RunAsDisableCommand(); }); + } + return OHOS::ERR_OK; }