[SB][Chips] Add atoms for status bar chip events.
Bug: 386821418
Flag: android.app.ui_rich_ongoing
Test: compiles
Change-Id: I8aed5b2517221923a14ae9284baa1f3a3e1ad477
diff --git a/stats/Android.bp b/stats/Android.bp
index a778acb..4beb13e 100644
--- a/stats/Android.bp
+++ b/stats/Android.bp
@@ -107,6 +107,7 @@
"enums/stats/tls/*.proto",
"enums/stats/tv/*.proto",
"enums/stats/wm/*.proto",
+ "enums/statusbar/*.proto",
"enums/system/**/*.proto",
"enums/telecomm/*.proto",
"enums/telephony/*.proto",
@@ -204,6 +205,7 @@
"atoms/selinux/*.proto",
"atoms/settings/*.proto",
"atoms/statsd/*.proto",
+ "atoms/statusbar/*.proto",
"atoms/sysui/*.proto",
"atoms/telecomm/*.proto",
"atoms/telephony/*.proto",
diff --git a/stats/atoms.proto b/stats/atoms.proto
index 5c5746d..326fd25 100644
--- a/stats/atoms.proto
+++ b/stats/atoms.proto
@@ -1420,6 +1420,7 @@
extensions 1089; // AppRestartOccurred app_restart_occurred
extensions 1090; // BinderCallsReported binder_calls_reported
extensions 1091; // DeviceLockFcmMessageReceived device_lock_fcm_message_received
+ extensions 1092; // StatusBarChipReported status_bar_chip_reported
extensions 9999; // Atom9999 atom_9999
// StatsdStats tracks platform atoms with ids up to 1500.
// Update StatsdStats::kMaxPushedAtomId when atom ids here approach that value.
diff --git a/stats/atoms/statusbar/statusbar_extension_atoms.proto b/stats/atoms/statusbar/statusbar_extension_atoms.proto
new file mode 100644
index 0000000..189d3b6
--- /dev/null
+++ b/stats/atoms/statusbar/statusbar_extension_atoms.proto
@@ -0,0 +1,49 @@
+/*
+* Copyright (C) 2025 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.statusbar;
+
+import "frameworks/proto_logging/stats/atoms.proto";
+import "frameworks/proto_logging/stats/atom_field_options.proto";
+import "frameworks/proto_logging/stats/enums/statusbar/enums.proto";
+
+extend Atom {
+ optional StatusBarChipReported status_bar_chip_reported = 1092 [(module) = "sysui"];
+}
+
+/**
+ * Pushes when a status bar chip is changed in some way (added, removed, tapped).
+ *
+ * Logged from:
+ * frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/chips/uievents/StatusBarChipsUiEventLogger.kt
+ *
+ * Estimated Logging Rate:
+ * Avg: 5 per device per day
+ */
+message StatusBarChipReported {
+ // The event_id (as for UiEventReported)
+ optional int32 event_id = 1;
+ // The type of chip
+ optional android.stats.statusbar.StatusBarChipType chip_type = 2;
+ // The instance ID to track the chip across other events
+ optional int32 instance_id = 3;
+ // How many chips are currently active in the status bar
+ optional int32 total_chips = 4;
+ // The rank that this chip currently has (omitted if this is a removal event)
+ optional int32 chip_rank = 5;
+}
diff --git a/stats/enums/statusbar/enums.proto b/stats/enums/statusbar/enums.proto
new file mode 100644
index 0000000..b74b912
--- /dev/null
+++ b/stats/enums/statusbar/enums.proto
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2025 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.statusbar;
+
+option java_package = "com.android.os.statusbar";
+option java_multiple_files = true;
+option java_outer_classname = "StatusBarProtoEnums";
+
+/**
+ * Enum used with StatusBarChipReported.
+ */
+enum StatusBarChipType {
+ STATUS_BAR_CHIP_TYPE_UNKNOWN = 0;
+ // The chip is for sharing screen or audio to another app
+ SCREEN_SHARE = 1;
+ // The chip is for system screen recording
+ SCREEN_RECORD = 2;
+ // The chip is for casting screen or audio to a different device
+ SCREEN_CAST = 3;
+ // The chip is for a call notification
+ CALL = 4;
+ // The chip is for a promoted notification
+ PROMOTED_NOTIFICATION = 5;
+}