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

Commit d58b364e authored by Abhijeet Kaur's avatar Abhijeet Kaur Committed by Android (Google) Code Review
Browse files

Merge "Remove no-op setListener method from dumpstate listener"

parents b1522012 ed5d6a6f
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -66,7 +66,6 @@ filegroup {
    name: "dumpstate_aidl",
    srcs: [
        "binder/android/os/IDumpstateListener.aidl",
        "binder/android/os/IDumpstateToken.aidl",
        "binder/android/os/IDumpstate.aidl",
    ],
    path: "binder",
+1 −37
Original line number Diff line number Diff line
@@ -58,8 +58,6 @@ static binder::Status exception(uint32_t code, const std::string& msg) {
    exit(0);
}

class DumpstateToken : public BnDumpstateToken {};

}  // namespace

DumpstateService::DumpstateService() : ds_(nullptr) {
@@ -81,38 +79,6 @@ status_t DumpstateService::Start() {
    return android::OK;
}

// Note: this method is part of the old flow and is not expected to be used in combination
// with startBugreport.
binder::Status DumpstateService::setListener(const std::string& name,
                                             const sp<IDumpstateListener>& listener,
                                             bool getSectionDetails,
                                             sp<IDumpstateToken>* returned_token) {
    *returned_token = nullptr;
    if (name.empty()) {
        MYLOGE("setListener(): name not set\n");
        return binder::Status::ok();
    }
    if (listener == nullptr) {
        MYLOGE("setListener(): listener not set\n");
        return binder::Status::ok();
    }
    std::lock_guard<std::mutex> lock(lock_);
    if (ds_ == nullptr) {
        ds_ = &(Dumpstate::GetInstance());
    }
    if (ds_->listener_ != nullptr) {
        MYLOGE("setListener(%s): already set (%s)\n", name.c_str(), ds_->listener_name_.c_str());
        return binder::Status::ok();
    }

    ds_->listener_name_ = name;
    ds_->listener_ = listener;
    ds_->report_section_ = getSectionDetails;
    *returned_token = new DumpstateToken();

    return binder::Status::ok();
}

binder::Status DumpstateService::startBugreport(int32_t calling_uid,
                                                const std::string& calling_package,
                                                const android::base::unique_fd& bugreport_fd,
@@ -121,8 +87,7 @@ binder::Status DumpstateService::startBugreport(int32_t calling_uid,
                                                const sp<IDumpstateListener>& listener) {
    MYLOGI("startBugreport() with mode: %d\n", bugreport_mode);

    // This is the bugreporting API flow, so ensure there is only one bugreport in progress at a
    // time.
    // Ensure there is only one bugreport in progress at a time.
    std::lock_guard<std::mutex> lock(lock_);
    if (ds_ != nullptr) {
        MYLOGE("Error! There is already a bugreport in progress. Returning.");
@@ -215,7 +180,6 @@ status_t DumpstateService::dump(int fd, const Vector<String16>&) {
    dprintf(fd, "name: %s\n", ds_->name_.c_str());
    dprintf(fd, "now: %ld\n", ds_->now_);
    dprintf(fd, "is_zipping: %s\n", ds_->IsZipping() ? "true" : "false");
    dprintf(fd, "listener: %s\n", ds_->listener_name_.c_str());
    dprintf(fd, "notification title: %s\n", ds_->options_->notification_title.c_str());
    dprintf(fd, "notification description: %s\n", ds_->options_->notification_description.c_str());

+0 −4
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@
#include <binder/BinderService.h>

#include "android/os/BnDumpstate.h"
#include "android/os/BnDumpstateToken.h"
#include "dumpstate.h"

namespace android {
@@ -38,9 +37,6 @@ class DumpstateService : public BinderService<DumpstateService>, public BnDumpst
    static char const* getServiceName();

    status_t dump(int fd, const Vector<String16>& args) override;
    binder::Status setListener(const std::string& name, const sp<IDumpstateListener>& listener,
                               bool getSectionDetails,
                               sp<IDumpstateToken>* returned_token) override;

    binder::Status startBugreport(int32_t calling_uid, const std::string& calling_package,
                                  const android::base::unique_fd& bugreport_fd,
+0 −12
Original line number Diff line number Diff line
@@ -17,24 +17,12 @@
package android.os;

import android.os.IDumpstateListener;
import android.os.IDumpstateToken;

/**
  * Binder interface for the currently running dumpstate process.
  * {@hide}
  */
interface IDumpstate {
    // TODO: remove method once startBugReport is used by Shell.
    /*
     * Sets the listener for this dumpstate progress.
     *
     * Returns a token used to monitor dumpstate death, or `nullptr` if the listener was already
     * set (the listener behaves like a Highlander: There Can be Only One).
     * Set {@code getSectionDetails} to true in order to receive callbacks with per section
     * progress details
     */
    IDumpstateToken setListener(@utf8InCpp String name, IDumpstateListener listener,
                                boolean getSectionDetails);

    // NOTE: If you add to or change these modes, please also change the corresponding enums
    // in system server, in BugreportParams.java.
+0 −24
Original line number Diff line number Diff line
/**
 * Copyright (c) 2016, The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.os;

/**
  * Token used by the IDumpstateListener to watch for dumpstate death.
  * {@hide}
  */
interface IDumpstateToken {
}
Loading