MediaMetrics: Use submitBuffer for more efficient logging
Test: Confirm Java logging in mediametrics dumpsys Bug: 138583596 Change-Id: I6a3479552ce4fe41a6fd983dc3b8a9d88495f304
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user