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

Commit 44c8d3ee authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6364069 from 4e2936c2 to rvc-release

Change-Id: I36c0271e3bc124530f26da92d860e1089e15eb3e
parents e20e8bf2 4e2936c2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -137,6 +137,8 @@ binder::Status DumpstateService::startBugreport(int32_t calling_uid,
    ds_info->calling_package = calling_package;

    pthread_t thread;
    // Initialize dumpstate
    ds_->Initialize();
    status_t err = pthread_create(&thread, nullptr, dumpstate_thread_main, ds_info);
    if (err != 0) {
        delete ds_info;
+5 −3
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ interface IDumpstateListener {
     *
     * @param progress the progress in [0, 100]
     */
    void onProgress(int progress);
    oneway void onProgress(int progress);

    // NOTE: If you add to or change these error codes, please also change the corresponding enums
    // in system server, in BugreportManager.java.
@@ -54,16 +54,18 @@ interface IDumpstateListener {

    /**
     * Called on an error condition with one of the error codes listed above.
     * This is not an asynchronous method since it can race with dumpstate exiting, thus triggering
     * death recipient.
     */
    void onError(int errorCode);

    /**
     * Called when taking bugreport finishes successfully.
     */
    void onFinished();
    oneway void onFinished();

    /**
     * Called when screenshot is taken.
     */
    void onScreenshotTaken(boolean success);
    oneway void onScreenshotTaken(boolean success);
}
+10 −7
Original line number Diff line number Diff line
@@ -2395,6 +2395,13 @@ void Dumpstate::SetOptions(std::unique_ptr<DumpOptions> options) {
    options_ = std::move(options);
}

void Dumpstate::Initialize() {
    /* gets the sequential id */
    uint32_t last_id = android::base::GetIntProperty(PROPERTY_LAST_ID, 0);
    id_ = ++last_id;
    android::base::SetProperty(PROPERTY_LAST_ID, std::to_string(last_id));
}

Dumpstate::RunStatus Dumpstate::Run(int32_t calling_uid, const std::string& calling_package) {
    Dumpstate::RunStatus status = RunInternal(calling_uid, calling_package);
    if (listener_ != nullptr) {
@@ -2505,11 +2512,6 @@ Dumpstate::RunStatus Dumpstate::RunInternal(int32_t calling_uid,
            : "";
    progress_.reset(new Progress(stats_path));

    /* gets the sequential id */
    uint32_t last_id = android::base::GetIntProperty(PROPERTY_LAST_ID, 0);
    id_ = ++last_id;
    android::base::SetProperty(PROPERTY_LAST_ID, std::to_string(last_id));

    if (acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_NAME) < 0) {
        MYLOGE("Failed to acquire wake lock: %s\n", strerror(errno));
    } else {
@@ -2837,8 +2839,9 @@ Dumpstate::RunStatus Dumpstate::ParseCommandlineAndRun(int argc, char* argv[]) {
        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.
        // an app; they are irrelevant here because bugreport is triggered via command line.
        // Update Last ID before calling Run().
        Initialize();
        status = Run(-1 /* calling_uid */, "" /* calling_package */);
    }
    return status;
+9 −1
Original line number Diff line number Diff line
@@ -216,6 +216,9 @@ class Dumpstate {
    /* Checkes whether dumpstate is generating a zipped bugreport. */
    bool IsZipping() const;

    /* Initialize dumpstate fields before starting bugreport generation */
    void Initialize();

    /*
     * Forks a command, waits for it to finish, and returns its status.
     *
@@ -329,7 +332,12 @@ class Dumpstate {

    struct DumpOptions;

    /* Main entry point for running a complete bugreport. */
    /*
     * Main entry point for running a complete bugreport.
     *
     * Initialize() dumpstate before calling this method.
     *
     */
    RunStatus Run(int32_t calling_uid, const std::string& calling_package);

    RunStatus ParseCommandlineAndRun(int argc, char* argv[]);
+1 −2
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ public:
        data.writeInterfaceToken(IAppOpsCallback::getInterfaceDescriptor());
        data.writeInt32(op);
        data.writeString16(packageName);
        remote()->transact(OP_CHANGED_TRANSACTION, data, &reply);
        remote()->transact(OP_CHANGED_TRANSACTION, data, &reply, IBinder::FLAG_ONEWAY);
    }
};

@@ -58,7 +58,6 @@ status_t BnAppOpsCallback::onTransact(
            String16 packageName;
            (void)data.readString16(&packageName);
            opChanged(op, packageName);
            reply->writeNoException();
            return NO_ERROR;
        } break;
        default:
Loading