From c1ff246f1a37d6619c238cf392e486ca4cf299d3 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Wed, 8 Jun 2016 15:02:35 -0700 Subject: [PATCH] Collect statistics of source build version Parse the last_install and report the source build version of an ota update. Related CL in: ag/1121141 Bug: 28658632 Change-Id: I5e835c144aabe97fda681f60397ebf4416f7bd4f --- core/java/android/os/RecoverySystem.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index 6c21398e280b1..7ff01daa68924 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -695,6 +695,7 @@ public class RecoverySystem { String line = null; int bytesWrittenInMiB = -1, bytesStashedInMiB = -1; int timeTotal = -1; + int sourceVersion = -1; while ((line = in.readLine()) != null) { // Here is an example of lines in last_install: // ... @@ -729,6 +730,8 @@ public class RecoverySystem { if (line.startsWith("time")) { timeTotal = scaled; + } else if (line.startsWith("source_version")) { + sourceVersion = scaled; } else if (line.startsWith("bytes_written")) { bytesWrittenInMiB = (bytesWrittenInMiB == -1) ? scaled : bytesWrittenInMiB + scaled; @@ -742,6 +745,9 @@ public class RecoverySystem { if (timeTotal != -1) { MetricsLogger.histogram(context, "ota_time_total", timeTotal); } + if (sourceVersion != -1) { + MetricsLogger.histogram(context, "ota_source_version", sourceVersion); + } if (bytesWrittenInMiB != -1) { MetricsLogger.histogram(context, "ota_written_in_MiBs", bytesWrittenInMiB); }