OSDN Git Service

Merge "Report the temperature during an OTA update" am: 47c7e7f41a am: 022682a721
authorTianjie Xu <xunchang@google.com>
Wed, 29 Mar 2017 18:34:14 +0000 (18:34 +0000)
committerTianjie Xu <xunchang@google.com>
Wed, 29 Mar 2017 22:58:55 +0000 (22:58 +0000)
am: 998c554463

Change-Id: I12a0f4c5fb768bdaa3a4baa4fa5bd7964b80110e
(cherry picked from commit d580a85b20a57984a3cb77685f5a10af8e2f2506)

core/java/android/os/RecoverySystem.java

index 5fa2461..5f66abd 100644 (file)
@@ -741,6 +741,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:
                 // ...
@@ -785,6 +789,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;
                 }
             }
 
@@ -804,6 +814,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);