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

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

Merge "Changes pulled data to use Parcel objects."

parents 85be5b82 1481fe14
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -579,6 +579,8 @@ LOCAL_SRC_FILES += \

LOCAL_AIDL_INCLUDES += system/update_engine/binder_bindings

LOCAL_AIDL_INCLUDES += core/java/android/os/StatsLogEventWrapper.aidl

LOCAL_AIDL_INCLUDES += frameworks/base/lowpan/java
LOCAL_SRC_FILES += \
	lowpan/java/android/net/lowpan/ILowpanEnergyScanCallback.aidl \
+4 −3
Original line number Diff line number Diff line
@@ -49,7 +49,8 @@ statsd_common_src := \
    src/stats_util.cpp

statsd_common_c_includes := \
    $(LOCAL_PATH)/src
    $(LOCAL_PATH)/src \
    $(LOCAL_PATH)/../../libs/services/include

statsd_common_aidl_includes := \
    $(LOCAL_PATH)/../../core/java
@@ -95,7 +96,7 @@ else
endif
LOCAL_PROTOC_OPTIMIZE_TYPE := lite-static

LOCAL_AIDL_INCLUDES := $(statsd_common_c_includes)
LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
LOCAL_C_INCLUDES += $(statsd_common_c_includes)

LOCAL_SHARED_LIBRARIES := $(statsd_common_shared_libraries)
@@ -117,7 +118,7 @@ LOCAL_MODULE := statsd_test
LOCAL_COMPATIBILITY_SUITE := device-tests
LOCAL_MODULE_TAGS := tests

LOCAL_AIDL_INCLUDES := $(statsd_common_c_includes)
LOCAL_AIDL_INCLUDES := $(statsd_common_aidl_includes)
LOCAL_C_INCLUDES += $(statsd_common_c_includes)

LOCAL_CFLAGS += \
+21 −6
Original line number Diff line number Diff line
@@ -63,9 +63,9 @@ void CompanionDeathRecipient::binderDied(const wp<IBinder>& who) {

// ======================================================================
StatsService::StatsService(const sp<Looper>& handlerLooper)
    : mStatsPullerManager(),
      mAnomalyMonitor(new AnomalyMonitor(2))  // TODO: Put this comment somewhere better
    : mAnomalyMonitor(new AnomalyMonitor(2))  // TODO: Put this comment somewhere better
{
    mStatsPullerManager = new StatsPullerManager();
    mUidMap = new UidMap();
    mConfigManager = new ConfigManager();
    mProcessor = new StatsLogProcessor(mUidMap);
@@ -193,6 +193,10 @@ status_t StatsService::command(FILE* in, FILE* out, FILE* err, Vector<String8>&
        if (!args[0].compare(String8("dump-report"))) {
            return cmd_dump_report(out, err, args);
        }

        if (!args[0].compare(String8("pull-source")) && args.size() > 1) {
            return cmd_print_pulled_metrics(out, args);
        }
    }

    print_cmd_help(out);
@@ -210,6 +214,11 @@ void StatsService::print_cmd_help(FILE* out) {
    fprintf(out, "  Prints the UID, app name, version mapping.\n");
    fprintf(out, "\n");
    fprintf(out, "\n");
    fprintf(out, "usage: adb shell cmds stats pull-source [int] \n");
    fprintf(out, "\n");
    fprintf(out, "  Prints the output of a pulled metrics source (int indicates source)\n");
    fprintf(out, "\n");
    fprintf(out, "\n");
    fprintf(out, "usage: adb shell cmd stats config remove [UID] NAME\n");
    fprintf(out, "usage: adb shell cmd stats config update [UID] NAME\n");
    fprintf(out, "\n");
@@ -353,6 +362,16 @@ status_t StatsService::cmd_print_uid_map(FILE* out) {
    return NO_ERROR;
}

status_t StatsService::cmd_print_pulled_metrics(FILE* out, const Vector<String8>& args) {
    int s = atoi(args[1].c_str());
    auto stats = mStatsPullerManager->Pull(s);
    for (const auto& it : stats) {
        fprintf(out, "Pull from %d: %s\n", s, it->ToString().c_str());
    }
    fprintf(out, "Pull from %d: Received %zu elements\n", s, stats.size());
    return NO_ERROR;
}

Status StatsService::informAllUidData(const vector<int32_t>& uid, const vector<int32_t>& version,
                                      const vector<String16>& app) {
    if (DEBUG) ALOGD("StatsService::informAllUidData was called");
@@ -414,10 +433,6 @@ Status StatsService::informPollAlarmFired() {

    if (DEBUG) ALOGD("StatsService::informPollAlarmFired succeeded");
    // TODO: determine what services to poll and poll (or ask StatsCompanionService to poll) them.
    String16 output = mStatsPullerManager.pull(StatsPullerManager::KERNEL_WAKELOCKS);
    // TODO: do something useful with the output instead of writing a string to screen.
    ALOGD("%s", String8(output).string());
    ALOGD("%d", int(output.size()));

    return Status::ok();
}
+6 −2
Original line number Diff line number Diff line
@@ -120,6 +120,11 @@ private:
     */
    status_t cmd_print_uid_map(FILE* out);

    /**
     * Print contents of a pulled metrics source.
     */
    status_t cmd_print_pulled_metrics(FILE* out, const Vector<String8>& args);

    /**
     * Update a configuration.
     */
@@ -132,9 +137,8 @@ private:

    /**
     * Fetches external metrics.
     * TODO: This should be an sp<>
     */
    StatsPullerManager mStatsPullerManager;
    sp<StatsPullerManager> mStatsPullerManager;

    /**
     * Tracks the configurations that have been passed to statsd.
+3 −5
Original line number Diff line number Diff line
@@ -37,9 +37,9 @@ const int KernelWakelockPuller::PULL_CODE_KERNEL_WAKELOCKS = 20;

// The reading and parsing are implemented in Java. It is not difficult to port over. But for now
// let StatsCompanionService handle that and send the data back.
String16 KernelWakelockPuller::pull() {
vector<StatsLogEventWrapper> KernelWakelockPuller::pull() {
    sp<IStatsCompanionService> statsCompanion = StatsService::getStatsCompanionService();
    String16 returned_value("");
    vector<StatsLogEventWrapper> returned_value;
    if (statsCompanion != NULL) {
        Status status = statsCompanion->pullData(KernelWakelockPuller::PULL_CODE_KERNEL_WAKELOCKS,
                                                 &returned_value);
@@ -47,12 +47,10 @@ String16 KernelWakelockPuller::pull() {
            ALOGW("error pulling kernel wakelock");
        }
        ALOGD("KernelWakelockPuller::pull succeeded!");
        // TODO: remove this when we integrate into aggregation chain.
        ALOGD("%s", String8(returned_value).string());
        return returned_value;
    } else {
        ALOGW("statsCompanion not found!");
        return String16();
        return returned_value;
    }
}

Loading