Loading cmds/dumpstate/dumpstate.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -2296,8 +2296,7 @@ static void FinalizeFile() { std::string final_path = ds.path_; if (ds.options_->OutputToCustomFile()) { std::string bugreport_dir = dirname(ds.options_->use_outfile.c_str()); final_path = ds.GetPath(bugreport_dir, ".zip"); final_path = ds.GetPath(ds.options_->out_dir, ".zip"); android::os::CopyFileToFile(ds.path_, final_path); } Loading Loading @@ -2418,7 +2417,7 @@ Dumpstate::RunStatus Dumpstate::DumpOptions::Initialize(int argc, char* argv[]) // clang-format off case 'd': do_add_date = true; break; case 'z': do_zip_file = true; break; case 'o': use_outfile = optarg; break; case 'o': out_dir = optarg; break; case 's': use_socket = true; break; case 'S': use_control_socket = true; break; case 'v': show_header_only = true; break; Loading cmds/dumpstate/dumpstate.h +4 −4 Original line number Diff line number Diff line Loading @@ -386,12 +386,12 @@ class Dumpstate { // The HAL is actually an API surface that can be validated, while the AIDL is not (@hide). ::android::hardware::dumpstate::V1_1::DumpstateMode dumpstate_hal_mode = ::android::hardware::dumpstate::V1_1::DumpstateMode::DEFAULT; // File descriptor to output zip file. Takes precedence over use_outfile.. // File descriptor to output zip file. Takes precedence over out_dir. android::base::unique_fd bugreport_fd; // File descriptor to screenshot file. android::base::unique_fd screenshot_fd; // Partial path to output file. std::string use_outfile; // Custom output directory. std::string out_dir; // Bugreport mode of the bugreport. std::string bugreport_mode; // Command-line arguments as string Loading Loading @@ -421,7 +421,7 @@ class Dumpstate { /* Returns if options specified require writing to custom file location */ bool OutputToCustomFile() { // Custom location is only honored in limited mode. return limited_only && !use_outfile.empty() && bugreport_fd.get() == -1; return limited_only && !out_dir.empty() && bugreport_fd.get() == -1; } }; Loading cmds/dumpstate/tests/dumpstate_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ TEST_F(DumpOptionsTest, InitializeNone) { EXPECT_FALSE(options_.do_add_date); EXPECT_FALSE(options_.do_zip_file); EXPECT_EQ("", options_.use_outfile); EXPECT_EQ("", options_.out_dir); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_control_socket); EXPECT_FALSE(options_.show_header_only); Loading Loading @@ -366,7 +366,7 @@ TEST_F(DumpOptionsTest, InitializeLimitedOnlyBugreport) { EXPECT_TRUE(options_.use_control_socket); EXPECT_FALSE(options_.do_vibrate); EXPECT_TRUE(options_.limited_only); EXPECT_EQ(" abc", std::string(options_.use_outfile)); EXPECT_EQ(" abc", std::string(options_.out_dir)); // Other options retain default values EXPECT_FALSE(options_.show_header_only); Loading Loading
cmds/dumpstate/dumpstate.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -2296,8 +2296,7 @@ static void FinalizeFile() { std::string final_path = ds.path_; if (ds.options_->OutputToCustomFile()) { std::string bugreport_dir = dirname(ds.options_->use_outfile.c_str()); final_path = ds.GetPath(bugreport_dir, ".zip"); final_path = ds.GetPath(ds.options_->out_dir, ".zip"); android::os::CopyFileToFile(ds.path_, final_path); } Loading Loading @@ -2418,7 +2417,7 @@ Dumpstate::RunStatus Dumpstate::DumpOptions::Initialize(int argc, char* argv[]) // clang-format off case 'd': do_add_date = true; break; case 'z': do_zip_file = true; break; case 'o': use_outfile = optarg; break; case 'o': out_dir = optarg; break; case 's': use_socket = true; break; case 'S': use_control_socket = true; break; case 'v': show_header_only = true; break; Loading
cmds/dumpstate/dumpstate.h +4 −4 Original line number Diff line number Diff line Loading @@ -386,12 +386,12 @@ class Dumpstate { // The HAL is actually an API surface that can be validated, while the AIDL is not (@hide). ::android::hardware::dumpstate::V1_1::DumpstateMode dumpstate_hal_mode = ::android::hardware::dumpstate::V1_1::DumpstateMode::DEFAULT; // File descriptor to output zip file. Takes precedence over use_outfile.. // File descriptor to output zip file. Takes precedence over out_dir. android::base::unique_fd bugreport_fd; // File descriptor to screenshot file. android::base::unique_fd screenshot_fd; // Partial path to output file. std::string use_outfile; // Custom output directory. std::string out_dir; // Bugreport mode of the bugreport. std::string bugreport_mode; // Command-line arguments as string Loading Loading @@ -421,7 +421,7 @@ class Dumpstate { /* Returns if options specified require writing to custom file location */ bool OutputToCustomFile() { // Custom location is only honored in limited mode. return limited_only && !use_outfile.empty() && bugreport_fd.get() == -1; return limited_only && !out_dir.empty() && bugreport_fd.get() == -1; } }; Loading
cmds/dumpstate/tests/dumpstate_test.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -172,7 +172,7 @@ TEST_F(DumpOptionsTest, InitializeNone) { EXPECT_FALSE(options_.do_add_date); EXPECT_FALSE(options_.do_zip_file); EXPECT_EQ("", options_.use_outfile); EXPECT_EQ("", options_.out_dir); EXPECT_FALSE(options_.use_socket); EXPECT_FALSE(options_.use_control_socket); EXPECT_FALSE(options_.show_header_only); Loading Loading @@ -366,7 +366,7 @@ TEST_F(DumpOptionsTest, InitializeLimitedOnlyBugreport) { EXPECT_TRUE(options_.use_control_socket); EXPECT_FALSE(options_.do_vibrate); EXPECT_TRUE(options_.limited_only); EXPECT_EQ(" abc", std::string(options_.use_outfile)); EXPECT_EQ(" abc", std::string(options_.out_dir)); // Other options retain default values EXPECT_FALSE(options_.show_header_only); Loading