Loading cmds/dumpstate/README.md +16 −12 Original line number Diff line number Diff line Loading @@ -14,7 +14,8 @@ Then incremental ones: mmm -j frameworks/native/cmds/dumpstate ``` If you're working on device-specific code, you might need to build them as well. Example: If you're working on device-specific code, you might need to build them as well. Example: ``` mmm -j frameworks/native/cmds/dumpstate device/acme/secret_device/dumpstate/ hardware/interfaces/dumpstate Loading @@ -26,13 +27,16 @@ mmm -j frameworks/native/cmds/dumpstate device/acme/secret_device/dumpstate/ har mmm -j frameworks/native/cmds/dumpstate && adb push ${OUT}/system/bin/dumpstate system/bin && adb push ${OUT}/system/lib64/*dumpstate*.so /system/lib64/ && adb shell am bug-report ``` Make sure that the device is remounted before running the above command. * If you're working with `userdebug` variant, you may need to run the following to remount your device: Make sure that the device is remounted before running the above command. * If you're working with `userdebug` variant, you may need to run the following to remount your device: ``` adb root && adb remount -R && adb wait-for-device && adb root && adb remount ``` * If you're working with `eng` variant, you may need to run the following to remount your device: * If you're working with `eng` variant, you may need to run the following to remount your device: ``` adb root && adb remount Loading Loading @@ -82,7 +86,6 @@ Example: adb shell setprop dumpstate.version split-dumpsys && adb shell dumpstate -v ``` Then to restore the default version: ``` Loading @@ -91,8 +94,9 @@ adb shell setprop dumpstate.version default ## Code style and formatting Use the style defined at the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html) and make sure to run the following command prior to `repo upload`: Use the style defined at the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html) and make sure to run the following command prior to `repo upload`: ``` git clang-format --style=file HEAD~ Loading cmds/dumpstate/dumpstate.cpp +10 −5 Original line number Diff line number Diff line Loading @@ -2602,22 +2602,27 @@ Dumpstate::RunStatus Dumpstate::CopyBugreportIfUserConsented() { return Dumpstate::RunStatus::ERROR; } /* Main entry point for dumpstate binary. */ int run_main(int argc, char* argv[]) { Dumpstate::RunStatus Dumpstate::ParseCommandlineAndRun(int argc, char* argv[]) { std::unique_ptr<Dumpstate::DumpOptions> options = std::make_unique<Dumpstate::DumpOptions>(); Dumpstate::RunStatus status = options->Initialize(argc, argv); if (status == Dumpstate::RunStatus::OK) { ds.SetOptions(std::move(options)); SetOptions(std::move(options)); // When directly running dumpstate binary, the output is not expected to be written // to any external file descriptor. assert(ds.options_->bugreport_fd.get() == -1); assert(options_->bugreport_fd.get() == -1); // calling_uid and calling_package are for user consent to share the bugreport with // an app; they are irrelvant here because bugreport is only written to a local // directory, and not shared. status = ds.Run(-1 /* calling_uid */, "" /* calling_package */); status = Run(-1 /* calling_uid */, "" /* calling_package */); } return status; } /* Main entry point for dumpstate binary. */ int run_main(int argc, char* argv[]) { Dumpstate::RunStatus status = ds.ParseCommandlineAndRun(argc, argv); switch (status) { case Dumpstate::RunStatus::OK: exit(0); Loading cmds/dumpstate/dumpstate.h +2 −0 Original line number Diff line number Diff line Loading @@ -322,6 +322,8 @@ class Dumpstate { /* Main entry point for running a complete bugreport. */ RunStatus Run(int32_t calling_uid, const std::string& calling_package); RunStatus ParseCommandlineAndRun(int argc, char* argv[]); /* Sets runtime options. */ void SetOptions(std::unique_ptr<DumpOptions> options); Loading cmds/dumpstate/tests/dumpstate_smoke_test.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ class ZippedBugreportGenerationTest : public Test { ds.listener_name_ = "Smokey"; ds.report_section_ = true; auto start = std::chrono::steady_clock::now(); run_main(ARRAY_SIZE(argv), argv); ds.ParseCommandlineAndRun(ARRAY_SIZE(argv), argv); auto end = std::chrono::steady_clock::now(); duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start); } Loading Loading
cmds/dumpstate/README.md +16 −12 Original line number Diff line number Diff line Loading @@ -14,7 +14,8 @@ Then incremental ones: mmm -j frameworks/native/cmds/dumpstate ``` If you're working on device-specific code, you might need to build them as well. Example: If you're working on device-specific code, you might need to build them as well. Example: ``` mmm -j frameworks/native/cmds/dumpstate device/acme/secret_device/dumpstate/ hardware/interfaces/dumpstate Loading @@ -26,13 +27,16 @@ mmm -j frameworks/native/cmds/dumpstate device/acme/secret_device/dumpstate/ har mmm -j frameworks/native/cmds/dumpstate && adb push ${OUT}/system/bin/dumpstate system/bin && adb push ${OUT}/system/lib64/*dumpstate*.so /system/lib64/ && adb shell am bug-report ``` Make sure that the device is remounted before running the above command. * If you're working with `userdebug` variant, you may need to run the following to remount your device: Make sure that the device is remounted before running the above command. * If you're working with `userdebug` variant, you may need to run the following to remount your device: ``` adb root && adb remount -R && adb wait-for-device && adb root && adb remount ``` * If you're working with `eng` variant, you may need to run the following to remount your device: * If you're working with `eng` variant, you may need to run the following to remount your device: ``` adb root && adb remount Loading Loading @@ -82,7 +86,6 @@ Example: adb shell setprop dumpstate.version split-dumpsys && adb shell dumpstate -v ``` Then to restore the default version: ``` Loading @@ -91,8 +94,9 @@ adb shell setprop dumpstate.version default ## Code style and formatting Use the style defined at the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html) and make sure to run the following command prior to `repo upload`: Use the style defined at the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html) and make sure to run the following command prior to `repo upload`: ``` git clang-format --style=file HEAD~ Loading
cmds/dumpstate/dumpstate.cpp +10 −5 Original line number Diff line number Diff line Loading @@ -2602,22 +2602,27 @@ Dumpstate::RunStatus Dumpstate::CopyBugreportIfUserConsented() { return Dumpstate::RunStatus::ERROR; } /* Main entry point for dumpstate binary. */ int run_main(int argc, char* argv[]) { Dumpstate::RunStatus Dumpstate::ParseCommandlineAndRun(int argc, char* argv[]) { std::unique_ptr<Dumpstate::DumpOptions> options = std::make_unique<Dumpstate::DumpOptions>(); Dumpstate::RunStatus status = options->Initialize(argc, argv); if (status == Dumpstate::RunStatus::OK) { ds.SetOptions(std::move(options)); SetOptions(std::move(options)); // When directly running dumpstate binary, the output is not expected to be written // to any external file descriptor. assert(ds.options_->bugreport_fd.get() == -1); assert(options_->bugreport_fd.get() == -1); // calling_uid and calling_package are for user consent to share the bugreport with // an app; they are irrelvant here because bugreport is only written to a local // directory, and not shared. status = ds.Run(-1 /* calling_uid */, "" /* calling_package */); status = Run(-1 /* calling_uid */, "" /* calling_package */); } return status; } /* Main entry point for dumpstate binary. */ int run_main(int argc, char* argv[]) { Dumpstate::RunStatus status = ds.ParseCommandlineAndRun(argc, argv); switch (status) { case Dumpstate::RunStatus::OK: exit(0); Loading
cmds/dumpstate/dumpstate.h +2 −0 Original line number Diff line number Diff line Loading @@ -322,6 +322,8 @@ class Dumpstate { /* Main entry point for running a complete bugreport. */ RunStatus Run(int32_t calling_uid, const std::string& calling_package); RunStatus ParseCommandlineAndRun(int argc, char* argv[]); /* Sets runtime options. */ void SetOptions(std::unique_ptr<DumpOptions> options); Loading
cmds/dumpstate/tests/dumpstate_smoke_test.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ class ZippedBugreportGenerationTest : public Test { ds.listener_name_ = "Smokey"; ds.report_section_ = true; auto start = std::chrono::steady_clock::now(); run_main(ARRAY_SIZE(argv), argv); ds.ParseCommandlineAndRun(ARRAY_SIZE(argv), argv); auto end = std::chrono::steady_clock::now(); duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start); } Loading