[IStats AIDL] Added API constants for restricted metrics

Bug: 268562388
Test: m
Change-Id: I9e159286005285d449acdda2255ef3ee50194fa5
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationId.aidl b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationId.aidl
index 848b5e9..63e6efa 100644
--- a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationId.aidl
+++ b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/AnnotationId.aidl
@@ -43,4 +43,14 @@
   DEFAULT_STATE = 6,
   TRIGGER_STATE_RESET = 7,
   STATE_NESTED = 8,
+  RESTRICTION_CATEGORY = 9,
+  FIELD_RESTRICTION_PERIPHERAL_DEVICE_INFO = 10,
+  FIELD_RESTRICTION_APP_USAGE = 11,
+  FIELD_RESTRICTION_APP_ACTIVITY = 12,
+  FIELD_RESTRICTION_HEALTH_CONNECT = 13,
+  FIELD_RESTRICTION_ACCESSIBILITY = 14,
+  FIELD_RESTRICTION_SYSTEM_SEARCH = 15,
+  FIELD_RESTRICTION_USER_ENGAGEMENT = 16,
+  FIELD_RESTRICTION_AMBIENT_SENSING = 17,
+  FIELD_RESTRICTION_DEMOGRAPHIC_CLASSIFICATION = 18,
 }
diff --git a/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/RestrictionCategory.aidl b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/RestrictionCategory.aidl
new file mode 100644
index 0000000..e94e59c
--- /dev/null
+++ b/stats/aidl/aidl_api/android.frameworks.stats/current/android/frameworks/stats/RestrictionCategory.aidl
@@ -0,0 +1,42 @@
+//
+// Copyright (C) 2023 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.
+//
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.frameworks.stats;
+@Backing(type="int") @VintfStability
+enum RestrictionCategory {
+  UNKNOWN = 0,
+  DIAGNOSTIC = 1,
+  SYSTEM_INTELLIGENCE = 2,
+  AUTHENTICATION = 3,
+  FRAUD_AND_ABUSE = 4,
+}
diff --git a/stats/aidl/android/frameworks/stats/AnnotationId.aidl b/stats/aidl/android/frameworks/stats/AnnotationId.aidl
index 31aa8ac..7f05512 100644
--- a/stats/aidl/android/frameworks/stats/AnnotationId.aidl
+++ b/stats/aidl/android/frameworks/stats/AnnotationId.aidl
@@ -64,4 +64,64 @@
      * This should only be used with binary state atoms.
      */
     STATE_NESTED = 8,
+
+    /**
+     * Annotation ID constant to indicate the restriction category of an atom.
+     * This annotation must only be attached to the atom id. This is an int annotation.
+     */
+    RESTRICTION_CATEGORY = 9,
+
+    /**
+     * Annotation ID to indicate that a field of an atom contains peripheral device info.
+     * This is a bool annotation.
+     */
+    FIELD_RESTRICTION_PERIPHERAL_DEVICE_INFO = 10,
+
+    /**
+     * Annotation ID to indicate that a field of an atom contains app usage information.
+     * This is a bool annotation.
+     */
+    FIELD_RESTRICTION_APP_USAGE = 11,
+
+    /**
+     * Annotation ID to indicate that a field of an atom contains app activity information.
+     * This is a bool annotation.
+     */
+    FIELD_RESTRICTION_APP_ACTIVITY = 12,
+
+    /**
+     * Annotation ID to indicate that a field of an atom contains health connect information.
+     * This is a bool annotation.
+     */
+    FIELD_RESTRICTION_HEALTH_CONNECT = 13,
+
+    /**
+     * Annotation ID to indicate that a field of an atom contains accessibility information.
+     * This is a bool annotation.
+     */
+    FIELD_RESTRICTION_ACCESSIBILITY = 14,
+
+    /**
+     * Annotation ID to indicate that a field of an atom contains system search information.
+     * This is a bool annotation.
+     */
+    FIELD_RESTRICTION_SYSTEM_SEARCH = 15,
+
+    /**
+     * Annotation ID to indicate that a field of an atom contains user engagement information.
+     * This is a bool annotation.
+     */
+    FIELD_RESTRICTION_USER_ENGAGEMENT = 16,
+
+    /**
+     * Annotation ID to indicate that a field of an atom contains ambient sensing information.
+     * This is a bool annotation.
+     */
+    FIELD_RESTRICTION_AMBIENT_SENSING = 17,
+
+    /**
+     * Annotation ID to indicate that a field of an atom contains demographic classification
+     * information. This is a bool annotation.
+     */
+    FIELD_RESTRICTION_DEMOGRAPHIC_CLASSIFICATION = 18,
 }
diff --git a/stats/aidl/android/frameworks/stats/RestrictionCategory.aidl b/stats/aidl/android/frameworks/stats/RestrictionCategory.aidl
new file mode 100644
index 0000000..3411d68
--- /dev/null
+++ b/stats/aidl/android/frameworks/stats/RestrictionCategory.aidl
@@ -0,0 +1,46 @@
+//
+// Copyright (C) 2023 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.
+//
+package android.frameworks.stats;
+
+/*
+ * Mimics packages/modules/StatsD/lib/libstatssocket/include/stats_annotations.h
+ * These ids must stay consistent with those in stats_annotations.h
+ */
+@VintfStability
+@Backing(type="int")
+enum RestrictionCategory {
+    UNKNOWN = 0,
+
+    /**
+     * Restriction category for atoms about diagnostics.
+     */
+    DIAGNOSTIC = 1,
+
+    /**
+     * Restriction category for atoms about system intelligence.
+     */
+    SYSTEM_INTELLIGENCE = 2,
+
+    /**
+     * Restriction category for atoms about authentication.
+     */
+    AUTHENTICATION = 3,
+
+    /**
+     * Restriction category for atoms about fraud and abuse.
+     */
+    FRAUD_AND_ABUSE = 4,
+}