Fix package name reporting in MediaDrm metrics.
The app package name was not previously reported in drm metrics. This
change reports the app package name as returned from the vendor metrics.
This is part of the fix. The other change will go into another project.
Bug: 64584568
Test: Unit tests, GTS tests, and Google Play.
Change-Id: Iee36d5203364c5f80a8b0fe9d9bbf5c167abefd1
diff --git a/drm/libmediadrm/PluginMetricsReporting.cpp b/drm/libmediadrm/PluginMetricsReporting.cpp
index a9302ea..57ff5b8 100644
--- a/drm/libmediadrm/PluginMetricsReporting.cpp
+++ b/drm/libmediadrm/PluginMetricsReporting.cpp
@@ -44,6 +44,13 @@
analyticsItem.setInt64(kParentAttribute, *parentId);
}
+ // Report the package name.
+ if (metricsGroup.has_app_package_name()) {
+ AString app_package_name(metricsGroup.app_package_name().c_str(),
+ metricsGroup.app_package_name().size());
+ analyticsItem.setPkgName(app_package_name);
+ }
+
for (int i = 0; i < metricsGroup.metric_size(); ++i) {
const MetricsGroup_Metric& metric = metricsGroup.metric(i);
if (!metric.has_name()) {
@@ -73,7 +80,12 @@
}
analyticsItem.setFinalized(true);
- analyticsItem.selfrecord();
+ if (!analyticsItem.selfrecord()) {
+ // Note the cast to int is because we build on 32 and 64 bit.
+ // The cast prevents a peculiar printf problem where one format cannot
+ // satisfy both.
+ ALOGE("selfrecord() returned false. sessioId %d", (int) sessionId);
+ }
for (int i = 0; i < metricsGroup.metric_sub_group_size(); ++i) {
const MetricsGroup& subGroup = metricsGroup.metric_sub_group(i);