Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 059a108e authored by Muhammad Hasan Khan's avatar Muhammad Hasan Khan Committed by Android (Google) Code Review
Browse files

Merge "arc: Rename use_outfile to out_dir + use as is" into rvc-dev

parents e4623041 3a4cfb4f
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -2296,8 +2296,7 @@ static void FinalizeFile() {


    std::string final_path = ds.path_;
    std::string final_path = ds.path_;
    if (ds.options_->OutputToCustomFile()) {
    if (ds.options_->OutputToCustomFile()) {
        std::string bugreport_dir = dirname(ds.options_->use_outfile.c_str());
        final_path = ds.GetPath(ds.options_->out_dir, ".zip");
        final_path = ds.GetPath(bugreport_dir, ".zip");
        android::os::CopyFileToFile(ds.path_, final_path);
        android::os::CopyFileToFile(ds.path_, final_path);
    }
    }


@@ -2418,7 +2417,7 @@ Dumpstate::RunStatus Dumpstate::DumpOptions::Initialize(int argc, char* argv[])
            // clang-format off
            // clang-format off
            case 'd': do_add_date = true;            break;
            case 'd': do_add_date = true;            break;
            case 'z': do_zip_file = 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_socket = true;             break;
            case 'S': use_control_socket = true;     break;
            case 'S': use_control_socket = true;     break;
            case 'v': show_header_only = true;       break;
            case 'v': show_header_only = true;       break;
+4 −4
Original line number Original line Diff line number Diff line
@@ -386,12 +386,12 @@ class Dumpstate {
        // The HAL is actually an API surface that can be validated, while the AIDL is not (@hide).
        // 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 dumpstate_hal_mode =
            ::android::hardware::dumpstate::V1_1::DumpstateMode::DEFAULT;
            ::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;
        android::base::unique_fd bugreport_fd;
        // File descriptor to screenshot file.
        // File descriptor to screenshot file.
        android::base::unique_fd screenshot_fd;
        android::base::unique_fd screenshot_fd;
        // Partial path to output file.
        // Custom output directory.
        std::string use_outfile;
        std::string out_dir;
        // Bugreport mode of the bugreport.
        // Bugreport mode of the bugreport.
        std::string bugreport_mode;
        std::string bugreport_mode;
        // Command-line arguments as string
        // Command-line arguments as string
@@ -421,7 +421,7 @@ class Dumpstate {
        /* Returns if options specified require writing to custom file location */
        /* Returns if options specified require writing to custom file location */
        bool OutputToCustomFile() {
        bool OutputToCustomFile() {
            // Custom location is only honored in limited mode.
            // 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;
        }
        }
    };
    };


+2 −2
Original line number Original line Diff line number Diff line
@@ -172,7 +172,7 @@ TEST_F(DumpOptionsTest, InitializeNone) {


    EXPECT_FALSE(options_.do_add_date);
    EXPECT_FALSE(options_.do_add_date);
    EXPECT_FALSE(options_.do_zip_file);
    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_socket);
    EXPECT_FALSE(options_.use_control_socket);
    EXPECT_FALSE(options_.use_control_socket);
    EXPECT_FALSE(options_.show_header_only);
    EXPECT_FALSE(options_.show_header_only);
@@ -366,7 +366,7 @@ TEST_F(DumpOptionsTest, InitializeLimitedOnlyBugreport) {
    EXPECT_TRUE(options_.use_control_socket);
    EXPECT_TRUE(options_.use_control_socket);
    EXPECT_FALSE(options_.do_vibrate);
    EXPECT_FALSE(options_.do_vibrate);
    EXPECT_TRUE(options_.limited_only);
    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
    // Other options retain default values
    EXPECT_FALSE(options_.show_header_only);
    EXPECT_FALSE(options_.show_header_only);