Delete atoms.proto from statsd

Use the atoms.proto in proto_logging as the source of truth. Also
migrates statsd log api gen to use the new atoms.proto

Bug: 167962588
Test: m -j && m CtsStatsdAtomHostTestCases

Change-Id: I36ec354d273dceace5245d7634c68ac63dc5a8cd
Merged-In: I36ec354d273dceace5245d7634c68ac63dc5a8cd
diff --git a/cmds/statsd/Android.bp b/cmds/statsd/Android.bp
index 0617eb6..e1b7c53 100644
--- a/cmds/statsd/Android.bp
+++ b/cmds/statsd/Android.bp
@@ -14,34 +14,6 @@
 // limitations under the License.
 //
 
-// ==========================================================
-// Build the library for use on the host
-// ==========================================================
-cc_library_host_shared {
-    name: "libstats_proto_host",
-    srcs: [
-        "src/atoms.proto",
-        "src/atom_field_options.proto",
-    ],
-
-    shared_libs: [
-        "libplatformprotos",
-    ],
-
-    proto: {
-        type: "full",
-        export_proto_headers: true,
-        include_dirs: [
-            "external/protobuf/src",
-        ],
-    },
-
-    export_shared_lib_headers: [
-        "libplatformprotos",
-    ]
-
-}
-
 cc_defaults {
     name: "statsd_defaults",
 
@@ -275,9 +247,8 @@
         // atom_field_options.proto needs field_options.proto, but that is
         // not included in libprotobuf-cpp-lite, so compile it here.
         ":libprotobuf-internal-protos",
+        ":libstats_internal_protos",
 
-        "src/atom_field_options.proto",
-        "src/atoms.proto",
         "src/shell/shell_data.proto",
         "src/stats_log.proto",
         "tests/AlarmMonitor_test.cpp",
@@ -341,7 +312,10 @@
 
     proto: {
         type: "lite",
-        include_dirs: ["external/protobuf/src"],
+        include_dirs: [
+            "external/protobuf/src",
+            "frameworks/proto_logging/stats",
+        ],
     },
 
 }
@@ -358,6 +332,7 @@
         // atom_field_options.proto needs field_options.proto, but that is
         // not included in libprotobuf-cpp-lite, so compile it here.
         ":libprotobuf-internal-protos",
+        ":libstats_internal_protos",
 
         "benchmark/duration_metric_benchmark.cpp",
         "benchmark/filter_value_benchmark.cpp",
@@ -367,14 +342,15 @@
         "benchmark/main.cpp",
         "benchmark/metric_util.cpp",
         "benchmark/stats_write_benchmark.cpp",
-        "src/atom_field_options.proto",
-        "src/atoms.proto",
         "src/stats_log.proto",
     ],
 
     proto: {
         type: "lite",
-        include_dirs: ["external/protobuf/src"],
+        include_dirs: [
+            "external/protobuf/src",
+            "frameworks/proto_logging/stats",
+        ],
     },
 
     cflags: [
@@ -406,11 +382,14 @@
     sdk_version: "core_current",
     proto: {
         type: "lite",
-        include_dirs: ["external/protobuf/src"],
+        include_dirs: [
+            "external/protobuf/src",
+            "frameworks/proto_logging/stats",
+        ],
     },
 
     srcs: [
-        "src/atoms.proto",
+        ":libstats_atoms_proto",
         "src/shell/shell_config.proto",
         "src/shell/shell_data.proto",
         "src/stats_log.proto",
diff --git a/cmds/statsd/src/shell/shell_data.proto b/cmds/statsd/src/shell/shell_data.proto
index 236bdbd..ec41cbc 100644
--- a/cmds/statsd/src/shell/shell_data.proto
+++ b/cmds/statsd/src/shell/shell_data.proto
@@ -21,7 +21,7 @@
 option java_package = "com.android.os.statsd";
 option java_outer_classname = "ShellDataProto";
 
-import "frameworks/base/cmds/statsd/src/atoms.proto";
+import "frameworks/proto_logging/stats/atoms.proto";
 
 // The output of shell subscription, including both pulled and pushed subscriptions.
 message ShellData {
diff --git a/cmds/statsd/src/stats_log.proto b/cmds/statsd/src/stats_log.proto
index ddd2725..bb07963 100644
--- a/cmds/statsd/src/stats_log.proto
+++ b/cmds/statsd/src/stats_log.proto
@@ -21,7 +21,7 @@
 option java_package = "com.android.os";
 option java_outer_classname = "StatsLog";
 
-import "frameworks/base/cmds/statsd/src/atoms.proto";
+import "frameworks/proto_logging/stats/atoms.proto";
 
 message DimensionsValue {
   optional int32 field = 1;
diff --git a/cmds/statsd/tests/LogEvent_test.cpp b/cmds/statsd/tests/LogEvent_test.cpp
index 5c170c0..41bdff8 100644
--- a/cmds/statsd/tests/LogEvent_test.cpp
+++ b/cmds/statsd/tests/LogEvent_test.cpp
@@ -16,8 +16,8 @@
 
 #include <gtest/gtest.h>
 
-#include "frameworks/base/cmds/statsd/src/atoms.pb.h"
 #include "frameworks/base/core/proto/android/stats/launcher/launcher.pb.h"
+#include "frameworks/proto_logging/stats/atoms.pb.h"
 #include "log/log_event_list.h"
 #include "stats_event.h"
 
diff --git a/cmds/statsd/tests/shell/ShellSubscriber_test.cpp b/cmds/statsd/tests/shell/ShellSubscriber_test.cpp
index e384b6a..1f0e2c8 100644
--- a/cmds/statsd/tests/shell/ShellSubscriber_test.cpp
+++ b/cmds/statsd/tests/shell/ShellSubscriber_test.cpp
@@ -20,9 +20,9 @@
 
 #include <vector>
 
-#include "frameworks/base/cmds/statsd/src/atoms.pb.h"
 #include "frameworks/base/cmds/statsd/src/shell/shell_config.pb.h"
 #include "frameworks/base/cmds/statsd/src/shell/shell_data.pb.h"
+#include "frameworks/proto_logging/stats/atoms.pb.h"
 #include "stats_event.h"
 #include "tests/metrics/metrics_test_helper.h"
 #include "tests/statsd_test_util.h"