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

Commit 8f358605 authored by Tej Singh's avatar Tej Singh
Browse files

Unregister native pull atom callback

Statsd changes to unregister a native puller.

Bug:14437325
Test: builds, boots
Change-Id: I1a1841de6e913f681c51919fcb9b18e30eb37801
parent e40ad05c
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -219,6 +219,11 @@ interface IStatsd {
     */
    oneway void unregisterPullAtomCallback(int uid, int atomTag);

    /**
     * Unregisters any pullAtomCallback for the given atom.
     */
    oneway void unregisterNativePullAtomCallback(int atomTag);

    /**
     * The install requires staging.
     */
+7 −0
Original line number Diff line number Diff line
@@ -1312,6 +1312,13 @@ Status StatsService::unregisterPullAtomCallback(int32_t uid, int32_t atomTag) {
    return Status::ok();
}

Status StatsService::unregisterNativePullAtomCallback(int32_t atomTag) {
    VLOG("StatsService::unregisterNativePullAtomCallback called.");
    int32_t uid = IPCThreadState::self()->getCallingUid();
    mPullerManager->UnregisterPullAtomCallback(uid, atomTag);
    return Status::ok();
}

Status StatsService::sendBinaryPushStateChangedAtom(const android::String16& trainNameIn,
                                                    const int64_t trainVersionCodeIn,
                                                    const int options,
+5 −0
Original line number Diff line number Diff line
@@ -202,6 +202,11 @@ public:
     */
    virtual Status unregisterPullAtomCallback(int32_t uid, int32_t atomTag) override;

    /**
     * Binder call to unregister any existing callback for the given atom and calling uid.
     */
    virtual Status unregisterNativePullAtomCallback(int32_t atomTag) override;

    /**
     * Binder call to log BinaryPushStateChanged atom.
     */
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ StatsCallbackPuller::StatsCallbackPuller(int tagId, const sp<IPullAtomCallback>&
}

bool StatsCallbackPuller::PullInternal(vector<shared_ptr<LogEvent>>* data) {
    VLOG("StatsCallbackPuller called for tag %d", mTagId)
    VLOG("StatsCallbackPuller called for tag %d", mTagId);
    if(mCallback == nullptr) {
        ALOGW("No callback registered");
        return false;
+7 −6
Original line number Diff line number Diff line
@@ -178,15 +178,16 @@ static void writeGpuHistogram(stats_event* event,
}

// graphicsStatsPullCallback is invoked by statsd service to pull GRAPHICS_STATS atom.
static bool graphicsStatsPullCallback(int32_t atom_tag, pulled_stats_event_list* data,
                                      const void* cookie) {
static status_pull_atom_return_t graphicsStatsPullCallback(int32_t atom_tag,
                                                           pulled_stats_event_list* data,
                                                           void* cookie) {
    JNIEnv* env = getJNIEnv();
    if (!env) {
        return false;
    }
    if (gGraphicsStatsServiceObject == nullptr) {
        ALOGE("Failed to get graphicsstats service");
        return false;
        return STATS_PULL_SKIP;
    }

    for (bool lastFullDay : {true, false}) {
@@ -198,7 +199,7 @@ static bool graphicsStatsPullCallback(int32_t atom_tag, pulled_stats_event_list*
            env->ExceptionDescribe();
            env->ExceptionClear();
            ALOGE("Failed to invoke graphicsstats service");
            return false;
            return STATS_PULL_SKIP;
        }
        if (!jdata) {
            // null means data is not available for that day.
@@ -217,7 +218,7 @@ static bool graphicsStatsPullCallback(int32_t atom_tag, pulled_stats_event_list*
        if (!success) {
            ALOGW("Parse failed on GraphicsStatsPuller error='%s' dataSize='%d'",
                  serviceDump.InitializationErrorString().c_str(), dataSize);
            return false;
            return STATS_PULL_SKIP;
        }

        for (int stat_index = 0; stat_index < serviceDump.stats_size(); stat_index++) {
@@ -244,7 +245,7 @@ static bool graphicsStatsPullCallback(int32_t atom_tag, pulled_stats_event_list*
            stats_event_build(event);
        }
    }
    return true;
    return STATS_PULL_SUCCESS;
}

// Register a puller for GRAPHICS_STATS atom with the statsd service.