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

Commit d6723796 authored by Bill Rassieur's avatar Bill Rassieur
Browse files

Merge master@5428150 into git_qt-dev-plus-aosp.

Change-Id: I60f2102ff30a9997a212b32944f03c452b5e2325
BUG: 129345239
parents b499f51e d3f4ea98
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include <unistd.h>

#include <chrono>
#include <fstream>
#include <functional>
#include <future>
#include <memory>
@@ -194,6 +195,15 @@ static bool UnlinkAndLogOnError(const std::string& file) {
    return true;
}

static bool IsFileEmpty(const std::string& file_path) {
    std::ifstream file(file_path, std::ios::binary | std::ios::ate);
    if(file.bad()) {
        MYLOGE("Cannot open file: %s\n", file_path.c_str());
        return true;
    }
    return file.tellg() <= 0;
}

}  // namespace
}  // namespace os
}  // namespace android
@@ -2149,7 +2159,7 @@ static void SendBugreportFinishedBroadcast() {
             "--es", "android.intent.extra.DUMPSTATE_LOG", ds.log_path_
        };
        // clang-format on
        if (ds.options_->do_fb) {
        if (ds.options_->do_fb && !android::os::IsFileEmpty(ds.screenshot_path_)) {
            am_args.push_back("--es");
            am_args.push_back("android.intent.extra.SCREENSHOT");
            am_args.push_back(ds.screenshot_path_);
@@ -2225,13 +2235,13 @@ static void SetOptionsFromMode(Dumpstate::BugreportMode mode, Dumpstate::DumpOpt
            break;
        case Dumpstate::BugreportMode::BUGREPORT_TELEPHONY:
            options->telephony_only = true;
            options->do_fb = true;
            options->do_fb = false;
            options->do_broadcast = true;
            break;
        case Dumpstate::BugreportMode::BUGREPORT_WIFI:
            options->wifi_only = true;
            options->do_zip_file = true;
            options->do_fb = true;
            options->do_fb = false;
            options->do_broadcast = true;
            break;
        case Dumpstate::BugreportMode::BUGREPORT_DEFAULT:
@@ -2735,8 +2745,8 @@ void Dumpstate::CheckUserConsent(int32_t calling_uid, const android::String16& c
    if (ics != nullptr) {
        MYLOGD("Checking user consent via incidentcompanion service\n");
        android::interface_cast<android::os::IIncidentCompanion>(ics)->authorizeReport(
            calling_uid, calling_package, 0x1 /* FLAG_CONFIRMATION_DIALOG */,
            consent_callback_.get());
            calling_uid, calling_package, String16(), String16(),
            0x1 /* FLAG_CONFIRMATION_DIALOG */, consent_callback_.get());
    } else {
        MYLOGD("Unable to check user consent; incidentcompanion service unavailable\n");
    }
+2 −2
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ TEST_F(DumpOptionsTest, InitializeTelephonyBugReport) {

    EXPECT_EQ(status, Dumpstate::RunStatus::OK);
    EXPECT_TRUE(options_.do_add_date);
    EXPECT_TRUE(options_.do_fb);
    EXPECT_FALSE(options_.do_fb);
    EXPECT_TRUE(options_.do_broadcast);
    EXPECT_TRUE(options_.do_zip_file);
    EXPECT_TRUE(options_.telephony_only);
@@ -404,7 +404,7 @@ TEST_F(DumpOptionsTest, InitializeWifiBugReport) {

    EXPECT_EQ(status, Dumpstate::RunStatus::OK);
    EXPECT_TRUE(options_.do_add_date);
    EXPECT_TRUE(options_.do_fb);
    EXPECT_FALSE(options_.do_fb);
    EXPECT_TRUE(options_.do_broadcast);
    EXPECT_TRUE(options_.do_zip_file);
    EXPECT_TRUE(options_.wifi_only);
+1 −1
Original line number Diff line number Diff line
@@ -171,7 +171,7 @@ binder::Status checkArgumentUuidTestOrNull(const std::unique_ptr<std::string>& u
}

binder::Status checkArgumentPackageName(const std::string& packageName) {
    if (is_valid_package_name(packageName.c_str())) {
    if (is_valid_package_name(packageName)) {
        return ok();
    } else {
        return exception(binder::Status::EX_ILLEGAL_ARGUMENT,
+4 −4
Original line number Diff line number Diff line
@@ -1564,7 +1564,7 @@ class RunDexoptAnalyzer : public ExecVHelper {
        if (vdex_fd >= 0) {
            AddArg(vdex_fd_arg);
        }
        AddArg(zip_fd_arg.c_str());
        AddArg(zip_fd_arg);
        if (profile_was_updated) {
            AddArg(assume_profile_changed);
        }
@@ -1572,9 +1572,9 @@ class RunDexoptAnalyzer : public ExecVHelper {
            AddArg(downgrade_flag);
        }
        if (class_loader_context != nullptr) {
            AddArg(class_loader_context_arg.c_str());
            AddArg(class_loader_context_arg);
            if (!class_loader_context_fds.empty()) {
                AddArg(class_loader_context_fds_arg.c_str());
                AddArg(class_loader_context_fds_arg);
            }
        }

@@ -2259,7 +2259,7 @@ bool reconcile_secondary_dex_file(const std::string& dex_path,
        drop_capabilities(uid);

        const char* volume_uuid_cstr = volume_uuid == nullptr ? nullptr : volume_uuid->c_str();
        if (!validate_secondary_dex_path(pkgname.c_str(), dex_path.c_str(), volume_uuid_cstr,
        if (!validate_secondary_dex_path(pkgname, dex_path, volume_uuid_cstr,
                uid, storage_flag)) {
            LOG(ERROR) << "Could not validate secondary dex path " << dex_path;
            _exit(kReconcileSecondaryDexValidationError);
+3 −7
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ bool view_compiler(const char* apk_path, const char* package_name, const char* o
    // and pass file descriptors.

    // Open input file
    unique_fd infd{open(apk_path, 0)};
    unique_fd infd{open(apk_path, O_RDONLY)}; // NOLINT(android-cloexec-open)
    if (infd.get() < 0) {
        PLOG(ERROR) << "Could not open input file: " << apk_path;
        return false;
@@ -53,7 +53,7 @@ bool view_compiler(const char* apk_path, const char* package_name, const char* o

    // Set up output file. viewcompiler can't open outputs by fd, but it can write to stdout, so
    // we close stdout and open it towards the right output.
    unique_fd outfd{open(out_dex_file, O_CREAT | O_TRUNC | O_WRONLY, 0644)};
    unique_fd outfd{open(out_dex_file, O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC, 0644)};
    if (outfd.get() < 0) {
        PLOG(ERROR) << "Could not open output file: " << out_dex_file;
        return false;
@@ -62,10 +62,6 @@ bool view_compiler(const char* apk_path, const char* package_name, const char* o
        PLOG(ERROR) << "Could not change output file permissions";
        return false;
    }
    if (close(STDOUT_FILENO) != 0) {
        PLOG(ERROR) << "Could not close stdout";
        return false;
    }
    if (dup2(outfd, STDOUT_FILENO) < 0) {
        PLOG(ERROR) << "Could not duplicate output file descriptor";
        return false;
Loading