@@ -128,6 +128,9 @@ using android::os::dumpstate::PropertiesHelper;
128128using android::os::dumpstate::TaskQueue;
129129using android::os::dumpstate::WaitForTask;
130130
131+ // BAD - See README.md: "Dumpstate philosophy: exec not link"
132+ // Do not add more complicated variables here, prefer to execute only. Don't link more code here.
133+
131134// Keep in sync with
132135// frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java
133136static const int TRACE_DUMP_TIMEOUT_MS = 10000 ; // 10 seconds
@@ -1273,6 +1276,8 @@ static void DumpKernelMemoryAllocations() {
12731276 }
12741277}
12751278
1279+ // BAD - See README.md: "Dumpstate philosophy: exec not link"
1280+ // This should all be moved into a separate binary rather than have complex logic here.
12761281static Dumpstate::RunStatus RunDumpsysTextByPriority (const std::string& title, int priority,
12771282 std::chrono::milliseconds timeout,
12781283 std::chrono::milliseconds service_timeout) {
@@ -1353,6 +1358,8 @@ static Dumpstate::RunStatus RunDumpsysTextNormalPriority(const std::string& titl
13531358 service_timeout);
13541359}
13551360
1361+ // BAD - See README.md: "Dumpstate philosophy: exec not link"
1362+ // This should all be moved into a separate binary rather than have complex logic here.
13561363static Dumpstate::RunStatus RunDumpsysProto (const std::string& title, int priority,
13571364 std::chrono::milliseconds timeout,
13581365 std::chrono::milliseconds service_timeout) {
@@ -1434,6 +1441,8 @@ static Dumpstate::RunStatus RunDumpsysNormal() {
14341441 * Dumpstate can pick up later and output to the bugreport. Using STDOUT_FILENO
14351442 * if it's not running in the parallel task.
14361443 */
1444+ // BAD - See README.md: "Dumpstate philosophy: exec not link"
1445+ // This should all be moved into a separate binary rather than have complex logic here.
14371446static void DumpHals (int out_fd = STDOUT_FILENO) {
14381447 RunCommand (" HARDWARE HALS" , {" lshal" , " --all" , " --types=all" },
14391448 CommandOptions::WithTimeout (10 ).AsRootIfAvailable ().Build (),
@@ -1490,6 +1499,9 @@ static void DumpHals(int out_fd = STDOUT_FILENO) {
14901499 }
14911500}
14921501
1502+ // BAD - See README.md: "Dumpstate philosophy: exec not link"
1503+ // This should all be moved into a separate binary rather than have complex logic here.
1504+ //
14931505// Dump all of the files that make up the vendor interface.
14941506// See the files listed in dumpFileList() for the latest list of files.
14951507static void DumpVintf () {
@@ -1519,6 +1531,8 @@ static void DumpExternalFragmentationInfo() {
15191531 printf (" ------ EXTERNAL FRAGMENTATION INFO ------\n " );
15201532 std::ifstream ifs (" /proc/buddyinfo" );
15211533 auto unusable_index_regex = std::regex{" Node\\ s+([0-9]+),\\ s+zone\\ s+(\\ S+)\\ s+(.*)" };
1534+ // BAD - See README.md: "Dumpstate philosophy: exec not link"
1535+ // This should all be moved into a separate binary rather than have complex logic here.
15221536 for (std::string line; std::getline (ifs, line);) {
15231537 std::smatch match_results;
15241538 if (std::regex_match (line, match_results, unusable_index_regex)) {
@@ -2464,6 +2478,8 @@ static dumpstate_hal_aidl::IDumpstateDevice::DumpstateMode GetDumpstateHalModeAi
24642478 return dumpstate_hal_aidl::IDumpstateDevice::DumpstateMode::DEFAULT;
24652479}
24662480
2481+ // BAD - See README.md: "Dumpstate philosophy: exec not link"
2482+ // This should all be moved into a separate binary rather than have complex logic here.
24672483static void DoDumpstateBoardHidl (
24682484 const sp<dumpstate_hal_hidl_1_0::IDumpstateDevice> dumpstate_hal_1_0,
24692485 const std::vector<::ndk::ScopedFileDescriptor>& dumpstate_fds,
0 commit comments