rebootFunction: Allow reboot function in ADB without root
This commit is contained in:
@@ -69,6 +69,14 @@ void basic_function_manager::registerFunction(
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
bool basic_function_manager::isUsed(const std::string name) const {
|
||||
if (_functions.empty()) return false;
|
||||
for (const auto &func : _functions) {
|
||||
if (func->name() == name) return func->isUsed();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool basic_function_manager::handleAll() const {
|
||||
LOGN(PMTF, INFO) << "running caught function commands in command-line."
|
||||
<< std::endl;
|
||||
|
||||
@@ -112,9 +112,11 @@ int Main(int argc, char **argv) {
|
||||
"directory with -S "
|
||||
"(--search-path)");
|
||||
|
||||
if (!Helper::hasSuperUser())
|
||||
throw Error(
|
||||
"Partition Manager Tool is requires super-user privileges!\n");
|
||||
if (!Helper::hasSuperUser()) {
|
||||
if (!(FuncManager.isUsed("reboot") && Helper::hasAdbPermissions()))
|
||||
throw Error(
|
||||
"Partition Manager Tool is requires super-user privileges!\n");
|
||||
}
|
||||
|
||||
return FuncManager.handleAll() == true ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
} catch (Helper::Error &error) {
|
||||
|
||||
Reference in New Issue
Block a user