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

Commit 06194d4d authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "MediaMetrics: Use submitBuffer for more efficient logging"

parents 74e7cae6 e7f750d1
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#include <binder/Parcel.h>
#include <jni.h>
#include <media/IMediaMetricsService.h>
#include <media/MediaMetricsItem.h>
#include <nativehelper/JNIHelp.h>
#include <variant>
@@ -150,14 +151,12 @@ static jint android_media_MediaMetrics_submit_bytebuffer(
        return (jint)BAD_VALUE;
    }

    // TODO: directly record item to MediaMetrics service.
    mediametrics::Item item;
    if (item.readFromByteString((char *)buffer, length) != NO_ERROR) {
        ALOGW("%s: cannot read from byte string", __func__);
        return (jint)BAD_VALUE;
    sp<IMediaMetricsService> service = mediametrics::BaseItem::getService();
    if (service == nullptr) {
        ALOGW("Cannot retrieve mediametrics service");
        return (jint)NO_INIT;
    }
    item.selfrecord();
    return (jint)NO_ERROR;
    return (jint)service->submitBuffer((char *)buffer, length);
}

// Helper function to convert a native PersistableBundle to a Java