@@ -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
@@ -1266,6 +1269,8 @@ static void DumpKernelMemoryAllocations() {
12661269 }
12671270}
12681271
1272+ // BAD - See README.md: "Dumpstate philosophy: exec not link"
1273+ // This should all be moved into a separate binary rather than have complex logic here.
12691274static Dumpstate::RunStatus RunDumpsysTextByPriority (const std::string& title, int priority,
12701275 std::chrono::milliseconds timeout,
12711276 std::chrono::milliseconds service_timeout) {
@@ -1346,6 +1351,8 @@ static Dumpstate::RunStatus RunDumpsysTextNormalPriority(const std::string& titl
13461351 service_timeout);
13471352}
13481353
1354+ // BAD - See README.md: "Dumpstate philosophy: exec not link"
1355+ // This should all be moved into a separate binary rather than have complex logic here.
13491356static Dumpstate::RunStatus RunDumpsysProto (const std::string& title, int priority,
13501357 std::chrono::milliseconds timeout,
13511358 std::chrono::milliseconds service_timeout) {
@@ -1427,6 +1434,8 @@ static Dumpstate::RunStatus RunDumpsysNormal() {
14271434 * Dumpstate can pick up later and output to the bugreport. Using STDOUT_FILENO
14281435 * if it's not running in the parallel task.
14291436 */
1437+ // BAD - See README.md: "Dumpstate philosophy: exec not link"
1438+ // This should all be moved into a separate binary rather than have complex logic here.
14301439static void DumpHals (int out_fd = STDOUT_FILENO) {
14311440 RunCommand (" HARDWARE HALS" , {" lshal" , " --all" , " --types=all" },
14321441 CommandOptions::WithTimeout (10 ).AsRootIfAvailable ().Build (),
@@ -1483,6 +1492,9 @@ static void DumpHals(int out_fd = STDOUT_FILENO) {
14831492 }
14841493}
14851494
1495+ // BAD - See README.md: "Dumpstate philosophy: exec not link"
1496+ // This should all be moved into a separate binary rather than have complex logic here.
1497+ //
14861498// Dump all of the files that make up the vendor interface.
14871499// See the files listed in dumpFileList() for the latest list of files.
14881500static void DumpVintf () {
@@ -1512,6 +1524,8 @@ static void DumpExternalFragmentationInfo() {
15121524 printf (" ------ EXTERNAL FRAGMENTATION INFO ------\n " );
15131525 std::ifstream ifs (" /proc/buddyinfo" );
15141526 auto unusable_index_regex = std::regex{" Node\\ s+([0-9]+),\\ s+zone\\ s+(\\ S+)\\ s+(.*)" };
1527+ // BAD - See README.md: "Dumpstate philosophy: exec not link"
1528+ // This should all be moved into a separate binary rather than have complex logic here.
15151529 for (std::string line; std::getline (ifs, line);) {
15161530 std::smatch match_results;
15171531 if (std::regex_match (line, match_results, unusable_index_regex)) {
@@ -2452,6 +2466,8 @@ static dumpstate_hal_aidl::IDumpstateDevice::DumpstateMode GetDumpstateHalModeAi
24522466 return dumpstate_hal_aidl::IDumpstateDevice::DumpstateMode::DEFAULT;
24532467}
24542468
2469+ // BAD - See README.md: "Dumpstate philosophy: exec not link"
2470+ // This should all be moved into a separate binary rather than have complex logic here.
24552471static void DoDumpstateBoardHidl (
24562472 const sp<dumpstate_hal_hidl_1_0::IDumpstateDevice> dumpstate_hal_1_0,
24572473 const std::vector<::ndk::ScopedFileDescriptor>& dumpstate_fds,
0 commit comments