From 42cfd56d47000dd85661656479dbcbdad8ba47ba Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Tue, 28 Mar 2017 16:59:16 -0700 Subject: [PATCH] Report the temperature during an OTA update Bug: 32518487 Test: mma Change-Id: I00494aff91b473ae54eff8d56910198f88083d40 --- core/java/android/os/RecoverySystem.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/java/android/os/RecoverySystem.java b/core/java/android/os/RecoverySystem.java index d48431afe6913..fae04a8700987 100644 --- a/core/java/android/os/RecoverySystem.java +++ b/core/java/android/os/RecoverySystem.java @@ -728,6 +728,10 @@ public class RecoverySystem { int timeTotal = -1; int uncryptTime = -1; int sourceVersion = -1; + int temperature_start = -1; + int temperature_end = -1; + int temperature_max = -1; + while ((line = in.readLine()) != null) { // Here is an example of lines in last_install: // ... @@ -772,6 +776,12 @@ public class RecoverySystem { } else if (line.startsWith("bytes_stashed")) { bytesStashedInMiB = (bytesStashedInMiB == -1) ? scaled : bytesStashedInMiB + scaled; + } else if (line.startsWith("temperature_start")) { + temperature_start = scaled; + } else if (line.startsWith("temperature_end")) { + temperature_end = scaled; + } else if (line.startsWith("temperature_max")) { + temperature_max = scaled; } } @@ -791,6 +801,15 @@ public class RecoverySystem { if (bytesStashedInMiB != -1) { MetricsLogger.histogram(context, "ota_stashed_in_MiBs", bytesStashedInMiB); } + if (temperature_start != -1) { + MetricsLogger.histogram(context, "ota_temperature_start", temperature_start); + } + if (temperature_end != -1) { + MetricsLogger.histogram(context, "ota_temperature_end", temperature_end); + } + if (temperature_max != -1) { + MetricsLogger.histogram(context, "ota_temperature_max", temperature_max); + } } catch (IOException e) { Log.e(TAG, "Failed to read lines in last_install", e);