Dumpstate: lshal runs in non-root in user build
lshal output is still useful even without root permission,
so include it in user build as well.
Test: lshal in user build
Test: dumpstate_test
Test: DumpstateTest.RunCommandAsRootIfAvailableOnUserBuild
Test: DumpstateTest.RunCommandAsRootIfAvailableOnDebugBuild
Test: DumpstateUtilTest.RunCommandAsRootIfAvailableOnDebugBuild
Test: DumpstateUtilTest.RunCommandAsRootIfAvailableOnUserBuild
Change-Id: Ie8ba9206feb6c2947ed38159ec9893e85d0e020d
Fixes: 66476950
diff --git a/cmds/dumpstate/DumpstateUtil.cpp b/cmds/dumpstate/DumpstateUtil.cpp
index 26702c4..7488827 100644
--- a/cmds/dumpstate/DumpstateUtil.cpp
+++ b/cmds/dumpstate/DumpstateUtil.cpp
@@ -103,6 +103,12 @@
return *this;
}
+CommandOptions::CommandOptionsBuilder& CommandOptions::CommandOptionsBuilder::AsRootIfAvailable() {
+ if (!PropertiesHelper::IsUserBuild())
+ values.account_mode_ = SU_ROOT;
+ return *this;
+}
+
CommandOptions::CommandOptionsBuilder& CommandOptions::CommandOptionsBuilder::DropRoot() {
values.account_mode_ = DROP_ROOT;
return *this;