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

Commit 13087ca6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Deprecated system properties used to update progress:"

parents cd7dedbe 009ecbbd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -58,8 +58,9 @@ LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/binder
LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/binder
LOCAL_C_INCLUDES := $(LOCAL_PATH)/binder
LOCAL_SRC_FILES := \
        binder/android/os/IDumpstate.aidl \
        binder/android/os/IDumpstateListener.aidl \
        binder/android/os/IDumpstate.aidl
        binder/android/os/IDumpstateToken.aidl

include $(BUILD_SHARED_LIBRARY)

+13 −5
Original line number Diff line number Diff line
@@ -25,6 +25,10 @@
namespace android {
namespace os {

namespace {
class DumpstateToken : public BnDumpstateToken {};
}

DumpstateService::DumpstateService() : ds_(Dumpstate::GetInstance()) {
}

@@ -45,32 +49,36 @@ status_t DumpstateService::Start() {
}

binder::Status DumpstateService::setListener(const std::string& name,
                                             const sp<IDumpstateListener>& listener, bool* set) {
                                             const sp<IDumpstateListener>& listener,
                                             sp<IDumpstateToken>* returned_token) {
    *returned_token = nullptr;
    if (name.empty()) {
        MYLOGE("setListener(): name not set\n");
        *set = false;
        return binder::Status::ok();
    }
    if (listener == nullptr) {
        MYLOGE("setListener(): listener not set\n");
        *set = false;
        return binder::Status::ok();
    }
    std::lock_guard<std::mutex> lock(lock_);
    if (ds_.listener_ != nullptr) {
        MYLOGE("setListener(%s): already set (%s)\n", name.c_str(), ds_.listener_name_.c_str());
        *set = false;
        return binder::Status::ok();
    }

    ds_.listener_name_ = name;
    ds_.listener_ = listener;
    *set = true;
    *returned_token = new DumpstateToken();

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

status_t DumpstateService::dump(int fd, const Vector<String16>&) {
    dprintf(fd, "id: %d\n", ds_.id_);
    dprintf(fd, "pid: %d\n", ds_.pid_);
    dprintf(fd, "update_progress: %s\n", ds_.update_progress_ ? "true" : "false");
    dprintf(fd, "update_progress_threshold: %d\n", ds_.update_progress_threshold_);
    dprintf(fd, "last_updated_progress: %d\n", ds_.last_updated_progress_);
    dprintf(fd, "progress:\n");
    ds_.progress_->Dump(fd, "  ");
    dprintf(fd, "args: %s\n", ds_.args_.c_str());
+2 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <binder/BinderService.h>

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

namespace android {
@@ -37,7 +38,7 @@ class DumpstateService : public BinderService<DumpstateService>, public BnDumpst

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

  private:
    Dumpstate& ds_;
+5 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.os;

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

/**
  * Binder interface for the currently running dumpstate process.
@@ -25,9 +26,10 @@ import android.os.IDumpstateListener;
interface IDumpstate {

    /*
     * Sets the listener for dumpstate progress.
     * Sets the listener for this dumpstate progress.
     *
     * Returns true if the listener was set (it's like a Highlander: There Can be Only One).
     * 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).
     */
    boolean setListener(@utf8InCpp String name, IDumpstateListener listener);
    IDumpstateToken setListener(@utf8InCpp String name, IDumpstateListener listener);
}
+24 −0
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