Add screen timeout extension event to statsd

Bug: 122960476
Test: tested locally on device using statsd_testdrive

Change-Id: I04342bc70ff4ef11c20836da52d9bfc5a6661aa2
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 30df850..4718143 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -234,6 +234,7 @@
         BluetoothBondStateChanged bluetooth_bond_state_changed = 165;
         BluetoothClassicPairingEventReported bluetooth_classic_pairing_event_reported = 166;
         BluetoothSmpPairingEventReported bluetooth_smp_pairing_event_reported = 167;
+        ScreenTimeoutExtensionReported screen_timeout_extension_reported = 168;
     }
 
     // Pulled events will start at field 10000.
@@ -4968,17 +4969,17 @@
  *     packages/apps/Nfc/src/com/android/nfc/cardemulation/AidRoutingManager.java
  */
 message NfcErrorOccurred {
-  enum Type {
-    UNKNOWN = 0;
-    CMD_TIMEOUT = 1;
-    ERROR_NOTIFICATION = 2;
-    AID_OVERFLOW = 3;
-  }
-  optional Type type = 1;
-  // If it's nci cmd timeout, log the timeout command.
-  optional uint32 nci_cmd = 2;
+    enum Type {
+        UNKNOWN = 0;
+        CMD_TIMEOUT = 1;
+        ERROR_NOTIFICATION = 2;
+        AID_OVERFLOW = 3;
+    }
+    optional Type type = 1;
+    // If it's nci cmd timeout, log the timeout command.
+    optional uint32 nci_cmd = 2;
 
-  optional uint32 error_ntf_status_code = 3;
+    optional uint32 error_ntf_status_code = 3;
 }
 
 /**
@@ -4987,14 +4988,14 @@
  *     packages/apps/Nfc/src/com/android/nfc/NfcService.java
  */
 message NfcStateChanged {
-  enum State {
-    UNKNOWN = 0;
-    OFF = 1;
-    ON = 2;
-    ON_LOCKED = 3; // Secure Nfc enabled.
-    CRASH_RESTART = 4; // NfcService watchdog timeout restart.
-  }
-  optional State state = 1;
+    enum State {
+        UNKNOWN = 0;
+        OFF = 1;
+        ON = 2;
+        ON_LOCKED = 3; // Secure Nfc enabled.
+        CRASH_RESTART = 4; // NfcService watchdog timeout restart.
+    }
+    optional State state = 1;
 }
 
 /**
@@ -5003,12 +5004,12 @@
  *     packages/apps/Nfc/src/com/android/nfc/P2pLinkManager.java
  */
 message NfcBeamOccurred {
-  enum Operation {
-      UNKNOWN = 0;
-      SEND = 1;
-      RECEIVE = 2;
-  }
-  optional Operation operation = 1;
+    enum Operation {
+        UNKNOWN = 0;
+        SEND = 1;
+        RECEIVE = 2;
+    }
+    optional Operation operation = 1;
 }
 
 /**
@@ -5018,16 +5019,16 @@
  *     packages/apps/Nfc/src/com/android/nfc/cardemulation/HostNfcFEmulationManager.java
  */
 message NfcCardemulationOccurred {
-  enum Category {
-      UNKNOWN = 0;
-      HCE_PAYMENT = 1;
-      HCE_OTHER = 2;
-      OFFHOST = 3;
-  }
-  // Transaction belongs to HCE payment or HCE other category, or offhost.
-  optional Category category = 1;
-  // SeName from transaction: SIMx, eSEx, HCE, HCEF.
-  optional string se_name = 2;
+    enum Category {
+        UNKNOWN = 0;
+        HCE_PAYMENT = 1;
+        HCE_OTHER = 2;
+        OFFHOST = 3;
+    }
+    // Transaction belongs to HCE payment or HCE other category, or offhost.
+    optional Category category = 1;
+    // SeName from transaction: SIMx, eSEx, HCE, HCEF.
+    optional string se_name = 2;
 }
 
 /**
@@ -5036,16 +5037,16 @@
  *     packages/apps/Nfc/src/com/android/nfc/NfcDispatcher.java
  */
 message NfcTagOccurred {
-  enum Type {
-      UNKNOWN = 0;
-      URL = 1;
-      BT_PAIRING = 2;
-      PROVISION = 3;
-      WIFI_CONNECT = 4;
-      APP_LAUNCH = 5;
-      OTHERS = 6;
-  }
-  optional Type type = 1;
+    enum Type {
+        UNKNOWN = 0;
+        URL = 1;
+        BT_PAIRING = 2;
+        PROVISION = 3;
+        WIFI_CONNECT = 4;
+        APP_LAUNCH = 5;
+        OTHERS = 6;
+    }
+    optional Type type = 1;
 }
 
 /**
@@ -5065,18 +5066,18 @@
  *     packages/apps/SecureElement/src/com/android/se/Terminal.java
  */
 message SeStateChanged {
-  enum State {
-    UNKNOWN = 0;
-    INITIALIZED = 1;
-    DISCONNECTED = 2;
-    CONNECTED = 3;
-    HALCRASH = 4;
-  }
-  optional State state = 1;
+    enum State {
+        UNKNOWN = 0;
+        INITIALIZED = 1;
+        DISCONNECTED = 2;
+        CONNECTED = 3;
+        HALCRASH = 4;
+    }
+    optional State state = 1;
 
-  optional string state_change_reason = 2;
-  // SIMx or eSEx.
-  optional string terminal = 3;
+    optional string state_change_reason = 2;
+    // SIMx or eSEx.
+    optional string terminal = 3;
 }
 
 /**
@@ -5085,15 +5086,15 @@
  *     packages/apps/SecureElement/src/com/android/se/Terminal.java
  */
 message SeOmapiReported {
-  enum Operation {
-    UNKNOWN = 0;
-    OPEN_CHANNEL = 1;
-  }
-  optional Operation operation = 1;
-  // SIMx or eSEx.
-  optional string terminal = 2;
+    enum Operation {
+        UNKNOWN = 0;
+        OPEN_CHANNEL = 1;
+    }
+    optional Operation operation = 1;
+    // SIMx or eSEx.
+    optional string terminal = 2;
 
-  optional string package_name = 3;
+    optional string package_name = 3;
 }
 
 /**
@@ -5275,3 +5276,15 @@
     }
     optional State state = 4;
 }
+
+/**
+ * Logs PowerManagerService screen timeout resets (extensions) that happen when an attention check
+ * returns true.
+ *
+ * Logged from:
+ *   frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
+ */
+message ScreenTimeoutExtensionReported {
+    // Describes how many times in a row did the power manager reset the screen off timeout.
+    optional uint32 consecutive_timeout_extended_count = 1;
+}