[Cherry-pick] Move AttributionNode out of atoms.proto

Bug: 253022649
Bug: 386700524
Test: stats-log-api-gen-test
Test: m statslog-textclassifier-java-gen
(cherry picked from https://android-review.googlesource.com/q/commit:a24ed2ef058d07416bd1c44bf39d195f61992c24)
(cherry picked from https://android-review.googlesource.com/q/commit:fdadd87bbc9fc189c393f7e0998eaf10f9a7cb11)
Merged-In: Ibe7a3da69110875e3a56f0d9799150f80763c29a
Change-Id: Ibe7a3da69110875e3a56f0d9799150f80763c29a
diff --git a/stats/Android.bp b/stats/Android.bp
index dd0be9c..38e5240 100644
--- a/stats/Android.bp
+++ b/stats/Android.bp
@@ -26,6 +26,7 @@
     srcs: [
         "atoms.proto",
         "atom_field_options.proto",
+        "attribution_node.proto",
         "enums/**/*.proto",
         "message/*.proto",
     ],
@@ -43,6 +44,7 @@
     name: "libstats_atoms_proto",
     srcs: [
         "atoms.proto",
+        "attribution_node.proto",
     ],
 }
 
@@ -51,6 +53,7 @@
     srcs: [
         "atoms.proto",
         "atom_field_options.proto",
+        "attribution_node.proto",
     ],
 }
 
diff --git a/stats/atoms.proto b/stats/atoms.proto
index 8a83c9f..73ad5f4 100644
--- a/stats/atoms.proto
+++ b/stats/atoms.proto
@@ -20,6 +20,7 @@
 option java_package = "com.android.os";
 option java_outer_classname = "AtomsProto";
 
+import "frameworks/proto_logging/stats/attribution_node.proto";
 import "frameworks/proto_logging/stats/atom_field_options.proto";
 import "frameworks/proto_logging/stats/enums/app/enums.proto";
 import "frameworks/proto_logging/stats/enums/app/job/enums.proto";
@@ -906,22 +907,6 @@
     reserved 83, 10008, 10036, 10040, 10041;
 }
 
-/**
- * This proto represents a node of an attribution chain.
- * Note: All attribution chains are represented as a repeated field of type
- * AttributionNode. It is understood that in such arrays, the order is that
- * of calls, that is [A, B, C] if A calls B that calls C.
- */
-message AttributionNode {
-    // The uid for a given element in the attribution chain.
-    optional 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.
-    optional string tag = 2;
-}
-
-
 /*
  * *****************************************************************************
  * Below are all of the individual atoms that are logged by Android via statsd.
diff --git a/stats/attribution_node.proto b/stats/attribution_node.proto
new file mode 100644
index 0000000..ec6f37e
--- /dev/null
+++ b/stats/attribution_node.proto
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+syntax = "proto2";
+
+package android.os.statsd;
+
+option java_package = "com.android.os";
+option java_multiple_files = true;
+
+/**
+ * This proto represents a node of an attribution chain.
+ * Note: All attribution chains are represented as a repeated field of type
+ * AttributionNode. It is understood that in such arrays, the order is that
+ * of calls, that is [A, B, C] if A calls B that calls C.
+ */
+message AttributionNode {
+    // The uid for a given element in the attribution chain.
+    optional 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.
+    optional string tag = 2;
+}
+
diff --git a/stats/stats_log_api_gen/Collation.cpp b/stats/stats_log_api_gen/Collation.cpp
index 3d1dce1..9d9fea8 100644
--- a/stats/stats_log_api_gen/Collation.cpp
+++ b/stats/stats_log_api_gen/Collation.cpp
@@ -21,6 +21,7 @@
 #include <map>
 
 #include "frameworks/proto_logging/stats/atoms.pb.h"
+#include "frameworks/proto_logging/stats/attribution_node.pb.h"
 #include "utils.h"
 
 namespace android {
diff --git a/stats/stats_log_api_gen/main.cpp b/stats/stats_log_api_gen/main.cpp
index 14f933e..5d179c3 100644
--- a/stats/stats_log_api_gen/main.cpp
+++ b/stats/stats_log_api_gen/main.cpp
@@ -10,6 +10,7 @@
 
 #include "Collation.h"
 #include "frameworks/proto_logging/stats/atoms.pb.h"
+#include "frameworks/proto_logging/stats/attribution_node.pb.h"
 #include "java_writer.h"
 #include "java_writer_q.h"
 #include "native_writer.h"
diff --git a/stats/stats_log_api_gen/test.proto b/stats/stats_log_api_gen/test.proto
index e93d0f4..c144dea 100644
--- a/stats/stats_log_api_gen/test.proto
+++ b/stats/stats_log_api_gen/test.proto
@@ -16,8 +16,8 @@
 
 syntax = "proto2";
 
-import "frameworks/proto_logging/stats/atoms.proto";
 import "frameworks/proto_logging/stats/atom_field_options.proto";
+import "frameworks/proto_logging/stats/attribution_node.proto";
 
 package android.stats_log_api_gen;