Organize intelligence counters together

Intelligence is a mainline module with several counter usecases.
Rather than create a very similar atom for each we'll use an event enum
for these simple counters.

Test: compile proto
Bug: 129491708

Change-Id: Ic30c0d6e15f6afbef90d89d1b53a20f8af38902e
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 5778fa9..a5dc252 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -22,8 +22,8 @@
 
 import "frameworks/base/cmds/statsd/src/atom_field_options.proto";
 import "frameworks/base/core/proto/android/app/enums.proto";
-import "frameworks/base/core/proto/android/app/settings_enums.proto";
 import "frameworks/base/core/proto/android/app/job/enums.proto";
+import "frameworks/base/core/proto/android/app/settings_enums.proto";
 import "frameworks/base/core/proto/android/bluetooth/a2dp/enums.proto";
 import "frameworks/base/core/proto/android/bluetooth/enums.proto";
 import "frameworks/base/core/proto/android/bluetooth/hci/enums.proto";
@@ -42,10 +42,11 @@
 import "frameworks/base/core/proto/android/service/usb.proto";
 import "frameworks/base/core/proto/android/stats/connectivity/network_stack.proto";
 import "frameworks/base/core/proto/android/stats/connectivity/resolv_stats.proto";
-import "frameworks/base/core/proto/android/stats/enums.proto";
-import "frameworks/base/core/proto/android/stats/docsui/docsui_enums.proto";
 import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy.proto";
 import "frameworks/base/core/proto/android/stats/devicepolicy/device_policy_enums.proto";
+import "frameworks/base/core/proto/android/stats/docsui/docsui_enums.proto";
+import "frameworks/base/core/proto/android/stats/enums.proto";
+import "frameworks/base/core/proto/android/stats/intelligence/enums.proto";
 import "frameworks/base/core/proto/android/stats/launcher/launcher.proto";
 import "frameworks/base/core/proto/android/stats/storage/storage_enums.proto";
 import "frameworks/base/core/proto/android/stats/style/style_enums.proto";
@@ -276,6 +277,8 @@
         SystemServerWatchdogOccurred system_server_watchdog_occurred = 185;
         TombStoneOccurred tomb_stone_occurred = 186;
         BluetoothClassOfDeviceReported bluetooth_class_of_device_reported = 187;
+        IntelligenceEventReported intelligence_event_reported =
+            188 [(log_from_module) = "intelligence"];
     }
 
     // Pulled events will start at field 10000.
@@ -5974,3 +5977,15 @@
     // not in throttling, higher value means deeper throttling.
     optional int32 state = 3;
 }
+
+/**
+ * Intelligence has several counter-type events that don't warrant a
+ * full separate atom. These are primarily API call counters but also include
+ * counters for feature usage and specific failure modes.
+ *
+ * Logged from the Intelligence mainline module.
+ */
+message IntelligenceEventReported {
+  optional android.stats.intelligence.EventType event_id = 1;
+  optional android.stats.intelligence.Status status = 2;
+}
diff --git a/core/proto/android/stats/intelligence/enums.proto b/core/proto/android/stats/intelligence/enums.proto
new file mode 100644
index 0000000..0c210e3
--- /dev/null
+++ b/core/proto/android/stats/intelligence/enums.proto
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2019 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.stats.intelligence;
+option java_outer_classname = "IntelligenceStatsEnums";
+
+enum Status {
+  // The value wasn't set.
+  // protoc requires enum values to be unique by package rather than enum type.
+  // This forces us to prefix the enum values.
+  STATUS_UNKNOWN = 0;
+  // The event succeeded.
+  STATUS_SUCCEEDED = 1;
+  // The event had an error.
+  STATUS_FAILED = 2;
+}
+
+enum EventType {
+  // The value wasn't set.
+  EVENT_UNKNOWN = 0;
+  // ContentSuggestionsService classifyContentSelections call.
+  EVENT_CONTENT_SUGGESTIONS_CLASSIFY_CONTENT_CALL = 1;
+  // ContentSuggestionsService suggestContentSelections call.
+  EVENT_CONTENT_SUGGESTIONS_SUGGEST_CONTENT_CALL = 2;
+}