Merge "[TeX] Updated job_scheduler counter metric config"
diff --git a/stats/Android.bp b/stats/Android.bp
index deb8f8d..bb40416 100644
--- a/stats/Android.bp
+++ b/stats/Android.bp
@@ -75,6 +75,7 @@
     srcs: [
         "atoms.proto",
         "atom_field_options.proto",
+        "attribution_node.proto",
         ":libstats_atom_message_protos",
     ] + enum_protos,
 
@@ -91,6 +92,7 @@
     name: "libstats_atoms_proto",
     srcs: [
         "atoms.proto",
+        "attribution_node.proto",
     ],
 }
 
@@ -99,6 +101,7 @@
     srcs: [
         "atoms.proto",
         "atom_field_options.proto",
+        "attribution_node.proto",
     ],
 }
 
diff --git a/stats/atoms.proto b/stats/atoms.proto
index 1cfecb2..7cb9e15 100644
--- a/stats/atoms.proto
+++ b/stats/atoms.proto
@@ -22,6 +22,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";
@@ -750,6 +751,7 @@
         BluetoothRemoteSupportedFeaturesReported bluetooth_remote_supported_features_reported = 531 [(module) = "bluetooth"];
         BluetoothLocalSupportedFeaturesReported bluetooth_local_supported_features_reported = 532 [(module) = "bluetooth"];
         BluetoothGattAppInfo bluetooth_gatt_app_info = 533 [(module) = "bluetooth"];
+        OdsignReported odsign_reported = 548 [(module) = "art"];
         // StatsdStats tracks platform atoms with ids upto 750.
         // Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value.
     }
@@ -955,22 +957,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.
@@ -21780,3 +21766,35 @@
     // The latency of selection issued in milli-second
     optional int32 selection_issued_latency_milli = 5;
 }
+
+/**
+ * Logs odsign metrics.
+ *
+ * Logged from:
+ *   frameworks/base/services/core/java/com/android/server/pm/dex/OdsignStatsLogger.java
+ */
+message OdsignReported {
+    enum Status {
+        // Unknown value.
+        STATUS_UNSPECIFIED = 0;
+        // All artifacts are generated and signed.
+        STATUS_ALL_OK = 1;
+        // Some artifacts are generated and signed, but odrefresh failed to generate the rest. See
+        // odrefresh metrics for the odrefresh failure.
+        STATUS_PARTIAL_OK = 2;
+        // Odrefresh failed to generate any artifact. See odrefresh metrics for the odrefresh
+        // failure.
+        STATUS_ODREFRESH_FAILED = 3;
+        // Odsign failed when interacting with Keystore.
+        STATUS_KEYSTORE_FAILED = 4;
+        // Odsign failed when initializing certificate.
+        STATUS_CERT_FAILED = 5;
+        // Odsign failed when cleaning up existing artifacts. Note that odrefresh may also clean up
+        // existing artifacts, and failures about that are logged as `STATUS_ODREFRESH_FAILED`.
+        STATUS_CLEANUP_FAILED = 6;
+        // Odsign failed when signing artifacts.
+        STATUS_SIGNING_FAILED = 7;
+    }
+
+    optional Status status = 1;
+}
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 fea5a37..5b1e3ea 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;