Add Soft AP atoms

Add atoms to log Soft AP start/stop events

Bug: 245824786
Test: build
Change-Id: I784dbba52caf521e17153ca7b5e89ad26c97545d
(cherry picked from commit c94bb036bf854fa78c02d0b018a503a0ed724f11)
Merged-In: I784dbba52caf521e17153ca7b5e89ad26c97545d
diff --git a/stats/atoms.proto b/stats/atoms.proto
index f3b7dfb..3524444 100644
--- a/stats/atoms.proto
+++ b/stats/atoms.proto
@@ -1022,6 +1022,8 @@
     extensions 675; // AdServicesMeasurementJobs ad_services_measurement_jobs
     extensions 676; // AdServicesMeasurementWipeout ad_services_measurement_wipeout
     extensions 679; // TvLowPowerStandbyPolicy tv_low_power_standby_policy
+    extensions 680; // SoftApStarted softap_started
+    extensions 681; // SoftApStopped softap_stopped
     extensions 684; // MediaCodecRendered media_codec_rendered
     extensions 9999; // Atom9999 atom_9999
     // StatsdStats tracks platform atoms with ids up to 900.
diff --git a/stats/atoms/wifi/wifi_extension_atoms.proto b/stats/atoms/wifi/wifi_extension_atoms.proto
index 50acef6..774f1ba 100644
--- a/stats/atoms/wifi/wifi_extension_atoms.proto
+++ b/stats/atoms/wifi/wifi_extension_atoms.proto
@@ -29,6 +29,8 @@
     optional WifiAwareNdpReported wifi_aware_ndp_reported = 638 [(module) = "wifi"];
     optional WifiAwareAttachReported wifi_aware_attach_reported = 639 [(module) = "wifi"];
     optional WifiSelfRecoveryTriggered wifi_self_recovery_triggered = 661 [(module) = "wifi"];
+    optional SoftApStarted soft_ap_started = 680 [(module) = "wifi"];
+    optional SoftApStopped soft_ap_stopped = 681 [(module) = "wifi"];
 }
 
 /**
@@ -91,3 +93,89 @@
     // Self recovery result
     optional Result result = 2;
 }
+
+/**
+ * Logged when Soft AP is started
+ */
+message SoftApStarted {
+    /**
+     * Result of starting Soft AP
+     */
+    enum StartResult {
+        // Unknown
+        START_RESULT_UNKNOWN = 0;
+        // Successful start
+        START_RESULT_SUCCESS = 1;
+        // General failure
+        START_RESULT_FAILURE_GENERAL = 2;
+        // Failure due to no channel available
+        START_RESULT_FAILURE_NO_CHANNEL = 3;
+        // Failure due to user rejection
+        START_RESULT_FAILURE_INTERFACE_CONFLICT_USER_REJECTED = 4;
+    }
+    // Result of the start event
+    optional StartResult result = 1;
+    // Role of the Soft AP
+    optional android.net.wifi.SoftApRole role = 2;
+    // First band bitmask indexed by WifiBandBucket
+    optional int32 band1 = 3;
+    // Second band bitmask indexed by WifiBandBucket
+    optional int32 band2 = 4;
+    // Whether DBS is supported or not
+    optional bool dbs_supported = 5;
+    // STA + AP concurrency capability of the device
+    optional android.net.wifi.StaApConcurrency sta_ap_concurrency = 6;
+    // STA connection status at the time of starting
+    optional android.net.wifi.StaStatus sta_status = 7;
+    // Authentication type of the Soft AP
+    optional android.net.wifi.WifiAuthType auth_type = 8;
+}
+
+/**
+ * Logged when Soft AP is stopped
+ */
+message SoftApStopped {
+    /**
+     * Type of Soft AP stop event
+     */
+    enum StopEvent {
+        // Unknown
+        STOP_EVENT_UNKNOWN = 0;
+        // Stopped by the user
+        STOP_EVENT_STOPPED = 1;
+        // Stopped due to interface down
+        STOP_EVENT_INTERFACE_DOWN = 2;
+        // Stopped due to interface destroyed
+        STOP_EVENT_INTERFACE_DESTROYED = 3;
+        // Stopped due to hostapd failure
+        STOP_EVENT_HOSTAPD_FAILURE = 4;
+        // Stopped due to no usage timeout
+        STOP_EVENT_NO_USAGE_TIMEOUT = 5;
+        // Single DBS instance stopped due to no usage timeout
+        STOP_EVENT_NO_USAGE_TIMEOUT_ONE_INSTANCE = 6;
+        // Single DBS instance stopped due to failure
+        STOP_EVENT_INSTANCE_FAILURE = 7;
+    }
+    // Soft AP stop event
+    optional StopEvent stop_event = 1;
+    // Role of the Soft AP
+    optional android.net.wifi.SoftApRole role = 2;
+    // Band of the Soft AP at the time of stopping
+    optional int32 band = 3;
+    // Whether the Soft AP is DBS
+    optional bool is_dbs = 4;
+    // STA + AP concurrency capability of the device
+    optional android.net.wifi.StaApConcurrency sta_ap_concurrency = 5;
+    // STA connection status at the time of stopping
+    optional android.net.wifi.StaStatus sta_status = 6;
+    // Whether or not the no usage timeout is enabled
+    optional bool is_timeout_enabled = 7;
+    // Duration of the session in seconds
+    optional int32 session_duration_seconds = 8;
+    // Authentication type of the Soft AP
+    optional android.net.wifi.WifiAuthType auth_type = 9;
+    // Wi-Fi standard of the Soft AP
+    optional android.net.wifi.WifiStandard standard = 10;
+    // Max num of associated clients for the entire session
+    optional int32 max_clients = 11;
+}
diff --git a/stats/enums/wifi/enums.proto b/stats/enums/wifi/enums.proto
index df6b96a..0bfde45 100644
--- a/stats/enums/wifi/enums.proto
+++ b/stats/enums/wifi/enums.proto
@@ -99,6 +99,10 @@
     AUTH_TYPE_FILS_SHA256 = 15;
     // IEEE 802.11ai FILS SK with SHA384.
     AUTH_TYPE_FILS_SHA384 = 16;
+    // Simultaneous Authentication of Equals transition mode.
+    AUTH_TYPE_SAE_TRANSITION = 17;
+    // Opportunistic Wireless Encryption transition mode.
+    AUTH_TYPE_OWE_TRANSITION = 18;
 }
 
 /**
@@ -156,3 +160,65 @@
     // Other failures
     ST_GENERIC_FAILURE = 14;
 }
+
+/**
+ * Soft AP Role
+ */
+enum SoftApRole {
+    // Unknown
+    ROLE_UNKNOWN = 0;
+    // Tethering AP
+    ROLE_TETHERING = 1;
+    // Local-only AP
+    ROLE_LOCAL_ONLY = 2;
+}
+
+/**
+ * Device support for STA + AP concurrency
+ */
+enum StaApConcurrency {
+    // Unknown
+    STA_AP_CONCURRENCY_UNKNOWN = 0;
+    // STA + AP concurrency unsupported
+    STA_AP_CONCURRENCY_UNSUPPORTED = 1;
+    // STA + Single AP concurrency supported
+    STA_AP_CONCURRENCY_SINGLE = 2;
+    // STA + Bridged AP concurrency supported
+    STA_AP_CONCURRENCY_DBS = 3;
+}
+
+/**
+ * Connection status of the existing primary STA
+ */
+enum StaStatus {
+    // Unknown
+    STA_STATUS_UNKNOWN = 0;
+    // STA is disconnected
+    STA_STATUS_DISCONNECTED = 1;
+    // STA is connected via 2.4GHz band
+    STA_STATUS_CONNECTED_2_GHZ = 2;
+    // STA is connected via 5GHz band
+    STA_STATUS_CONNECTED_5_GHZ = 3;
+    // STA is connected via 6GHz band
+    STA_STATUS_CONNECTED_6_GHZ = 4;
+}
+
+/**
+ * Wi-Fi Standards
+ */
+enum WifiStandard {
+    // Unknown
+    WIFI_STANDARD_UNKNOWN = 0;
+    // Wi-Fi 802.11a/b/g
+    WIFI_STANDARD_LEGACY = 1;
+    // Wi-Fi 802.11n
+    WIFI_STANDARD_11N = 2;
+    // Wi-Fi 802.11ac
+    WIFI_STANDARD_11AC = 3;
+    // Wi-Fi 802.11ax
+    WIFI_STANDARD_11AX = 4;
+    // Wi-Fi 802.11ad
+    WIFI_STANDARD_11AD = 5;
+    // Wi-Fi 802.11be
+    WIFI_STANDARD_11BE = 6;
+}