Stats log api for attribution chain.

Test: all unit test passed.
Change-Id: I628d409e517f4f95c8da1d0c7fd4d514c1d9196d
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 716fee6..617919d 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -97,19 +97,29 @@
         CpuTimePerUidFreqPulled cpu_time_per_uid_freq_pulled = 1010;
         WifiActivityEnergyInfoPulled wifi_activity_energy_info_pulled = 1011;
         ModemActivityInfoPulled modem_activity_info_pulled = 1012;
+        AttributionChainDummyAtom attribution_chain_dummy_atom = 10000;
     }
 }
 
 /**
- * A WorkSource represents the chained attribution of applications that
- * resulted in a particular bit of work being done.
+ * An attribution represents an application or module that is part of process where a particular bit
+ * of work is done.
  */
-message WorkSource {
-    // The uid for a given element in the attribution chain.
-    repeated int32 uid = 1;
-    // The (optional) string tag for an element in the attribution chain. If the
-    // element has no tag, it is encoded as an empty string.
-    repeated string tag = 2;
+message Attribution {
+    // The uid for an application or module.
+    optional int32 uid = 1;
+    // The string tag for the attribution node.
+    optional string tag = 2;
+}
+
+/**
+ * An attribution chain represents the chained attributions of applications or modules that
+ * resulted in a particular bit of work being done.
+ * The ordering of the attributions is that of calls, that is uid = [A, B, C] if A calls B that
+ * calls C.
+ */
+message AttributionChain {
+    repeated Attribution attribution = 1;
 }
 
 /*
@@ -127,7 +137,7 @@
  *   - The CamelCase name of the message type should match the
  *     underscore_separated name as defined in Atom.
  *   - If an atom represents work that can be attributed to an app, there can
- *     be exactly one WorkSource field. It must be field number 1.
+ *     be exactly one AttributionChain field. It must be field number 1.
  *   - A field that is a uid should be a string field, tagged with the [xxx]
  *     annotation. The generated code on android will be represented by UIDs,
  *     and those UIDs will be translated in xxx to those strings.
@@ -138,6 +148,11 @@
  * *****************************************************************************
  */
 
+message AttributionChainDummyAtom {
+    optional AttributionChain attribution_chain = 1;
+    optional int32 value = 2;
+}
+
 /**
  * Logs when the screen state changes.
  *