diff options
author | 2024-12-03 23:13:50 +0000 | |
---|---|---|
committer | 2024-12-05 20:12:06 +0000 | |
commit | ac914b9c3566be3b0b5c37b0f2929d029af6cf81 (patch) | |
tree | ac74b67f47314e7a5a05ddc3bcb92903bee954b9 | |
parent | 68d6c7f560a8bf107c5985abc38f8d84f0dfac30 (diff) |
Add all USD parcelables and enums to the
mainline supplicant AIDL interface.
Definitions are copied directly from the
the Vendor AIDL definitions in ag/30346475.
Note that we will follow the new convention
here, where parcelables are defined in
the interface where they are used.
Bug: 365585450
Flag: EXEMPT change to AIDL interface
Test: m
Change-Id: I194ad89d21c80fc9efe2c1dbca7cca086b3c688c
6 files changed, 430 insertions, 0 deletions
diff --git a/aidl/mainline_supplicant/Android.bp b/aidl/mainline_supplicant/Android.bp index 285af3d6cf..00600440eb 100644 --- a/aidl/mainline_supplicant/Android.bp +++ b/aidl/mainline_supplicant/Android.bp @@ -26,6 +26,11 @@ aidl_interface { "com.android.wifi", ], min_sdk_version: "30", + lint: { + // Disable linter to avoid error about fixed size arrays. + // Interface will only be accessed on devices >= B. + enabled: false, + }, }, ndk: { enabled: true, diff --git a/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/IUsdCallback.aidl b/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/IUsdCallback.aidl new file mode 100644 index 0000000000..fd396a71d0 --- /dev/null +++ b/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/IUsdCallback.aidl @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2024 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.system.wifi.mainline_supplicant; + +import android.system.wifi.mainline_supplicant.UsdMessageInfo; +import android.system.wifi.mainline_supplicant.UsdServiceProtoType; + +/** + * Callbacks for Unsynchronized Service Discovery (USD) operations. + */ +interface IUsdCallback { + /** + * Information about a USD discovery session with a specific peer. + */ + @VintfStability + parcelable UsdServiceDiscoveryInfo { + /** + * Identifier for this device. + */ + int ownId; + + /** + * Identifier for the discovered peer device. + */ + int peerId; + + /** + * MAC address of the discovered peer device. + */ + byte[6] peerMacAddress; + + /** + * Match filter from the discovery packet (publish or subscribe) which caused service + * discovery. + */ + byte[] matchFilter; + + /** + * Service protocol that is being used (ex. Generic, CSA Matter). + */ + UsdServiceProtoType serviceProtoType; + + /** + * Arbitrary service specific information communicated in discovery packets. + * There is no semantic meaning to these bytes. They are passed-through from publisher to + * subscriber as-is with no parsing. + */ + byte[] serviceSpecificInfo; + + /** + * Whether Further Service Discovery (FSD) is enabled. + */ + boolean isFsd; + } + + /** + * Codes indicating the status of USD operations. + */ + @Backing(type="int") + enum UsdReasonCode { + /** + * Unknown failure occurred. + */ + FAILURE_UNKNOWN = 0, + + /** + * The operation timed out. + */ + TIMEOUT = 1, + + /** + * The operation was requested by the user. + */ + USER_REQUESTED = 2, + + /** + * Invalid arguments were provided. + */ + INVALID_ARGS = 3 + } +} diff --git a/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/IUsdInterface.aidl b/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/IUsdInterface.aidl new file mode 100644 index 0000000000..46b124ea30 --- /dev/null +++ b/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/IUsdInterface.aidl @@ -0,0 +1,242 @@ +/* + * Copyright (C) 2024 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.system.wifi.mainline_supplicant; + +import android.system.wifi.mainline_supplicant.UsdMessageInfo; +import android.system.wifi.mainline_supplicant.UsdServiceProtoType; + +/** + * Interface for performing Unsynchronized Service Discovery (USD) operations. + */ +interface IUsdInterface { + /** + * Capabilities supported by USD. Values are only valid if |isUsdPublisherSupported| + * and/or |isUsdSubscriberSupported| are true. + */ + parcelable UsdCapabilities { + /** + * Whether USD Publisher is supported on this device. + */ + boolean isUsdPublisherSupported; + + /** + * Whether USD Subscriber is supported on this device. + */ + boolean isUsdSubscriberSupported; + + /** + * Maximum allowed length (in bytes) for the Service Specific Info (SSI). + */ + int maxLocalSsiLengthBytes; + + /** + * Maximum allowed length (in bytes) for the service name. + */ + int maxServiceNameLengthBytes; + + /** + * Maximum allowed length (in bytes) for a match filter. + */ + int maxMatchFilterLengthBytes; + + /** + * Maximum number of allowed publish sessions. + */ + int maxNumPublishSessions; + + /** + * Maximum number of allowed subscribe sessions. + */ + int maxNumSubscribeSessions; + } + + /** + * Data used in both publish and subscribe configurations. + */ + parcelable BaseConfig { + /** + * Service name of the USD session. A UTF-8 encoded string from 1 to 255 bytes in length. + * The only acceptable single-byte UTF-8 symbols for a Service Name are alphanumeric + * values (A-Z, a-z, 0-9), hyphen ('-'), period ('.'), and underscore ('_'). All + * valid multi-byte UTF-8 characters are acceptable in a Service Name. + */ + @utf8InCpp String serviceName; + + /** + * Service protocol type for the USD session (ex. Generic, CSA Matter). + */ + UsdServiceProtoType serviceProtoType; + + /** + * Details about the service being offered or being looked for. This information is + * transmitted within Service Discovery frames, and is used to help devices find each other + * and establish connections. The format and content of the service specific information are + * flexible and can be determined by the application. + */ + byte[] serviceSpecificInfo; + + /** + * Ordered sequence of <length, value> pairs (|length| uses 1 byte and contains the number + * of bytes in the |value| field) which specify further match criteria (beyond the service + * name). + * + * The match behavior is specified in details in the NAN spec. + * Publisher: used if provided. + * Subscriber: used (if provided) only in ACTIVE sessions. + * + * Max length: |UsdCapabilities.maxMatchFilterLength|. + * NAN Spec: matching_filter_tx and Service Descriptor Attribute (SDA) / Matching Filter + */ + @nullable byte[] txMatchFilter; + + /** + * Ordered sequence of <length, value> pairs (|length| uses 1 byte and contains the number + * of bytes in the |value| field) which specify further match criteria (beyond the service + * name). + * + * The match behavior is specified in details in the NAN spec. + * Publisher: used in SOLICITED or SOLICITED_UNSOLICITED sessions. + * Subscriber: used in ACTIVE or PASSIVE sessions. + * + * Max length: |UsdCapabilities.maxMatchFilterLength|. + * NAN Spec: matching_filter_rx + */ + @nullable byte[] rxMatchfilter; + + /** + * Time interval (in seconds) that a USD session will be alive. + * The session will be terminated when the time to live (TTL) is reached, triggering either + * |IUsdCallback.onPublishTerminated| for Publish, or |IUsdCallback.onSubscribeTerminated| + * for Subscribe. + */ + int ttlSec; + + /** + * Frequency where the device should begin to dwell. Default value is channel 6 (2.437 GHz), + * but other values may be selected per regulation in the geographical location. + */ + int defaultFreqMhz; + + /** + * Channels which can be switched to. May contain any of the 20 MHz channels in the + * 2.4 Ghz and/or 5 Ghz bands, per regulation in the geographical location. + */ + int[] freqsMhz; + } + + /** + * Subscribe modes that this session can be configured in. + */ + enum SubscribeType { + /** + * Subscribe function does not request transmission of any Subscribe messages, but checks + * for matches in received Publish messages. + */ + PASSIVE_MODE = 0, + /** + * Subscribe function additionally requests transmission of Subscribe messages and processes + * Publish messages. + */ + ACTIVE_MODE = 1, + } + + /** + * Parameters for configuring a USD subscribe session. + */ + parcelable SubscribeConfig { + /** + * Base USD session parameters. + */ + BaseConfig baseConfig; + + /** + * Subscribe mode that this session should be configured in. + */ + SubscribeType subscribeType; + + /** + * Recommended periodicity (in milliseconds) of query transmissions for the session. + */ + int queryPeriodMillis; + } + + /** + * Type of USD publishing. + */ + enum PublishType { + /** + * Only transmissions that are triggered by a specific event. + */ + SOLICITED_ONLY = 0, + + /** + * Only transmissions that are not requested. + */ + UNSOLICITED_ONLY = 1, + + /** + * Both solicited and unsolicited transmissions. + */ + SOLICITED_AND_UNSOLICITED = 2, + } + + /** + * Types of USD publish transmissions. + */ + @Backing(type="int") + enum PublishTransmissionType { + /** + * Sends data from one device to a single, specific destination device. + */ + UNICAST = 0, + + /** + * Sends data from one device to a group of devices on the network simultaneously. + */ + MULTICAST = 1, + } + + /** + * Parameters for configuring a USD publish session. + */ + parcelable PublishConfig { + /** + * Base USD session parameters. + */ + BaseConfig baseConfig; + + /** + * Types of transmissions (solicited vs. unsolicited) which should be generated. + */ + PublishType publishType; + + /** + * Whether Further Service Discovery (FSD) is enabled. + */ + boolean isFsd; + + /** + * Interval (in milliseconds) for sending unsolicited publish transmissions. + */ + int announcementPeriodMillis; + + /** + * Type of the publish transmission (ex. unicast, multicast). + */ + PublishTransmissionType transmissionType; + } +} diff --git a/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/SupplicantStatusCode.aidl b/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/SupplicantStatusCode.aidl index 2086bc884c..11bd6ca937 100644 --- a/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/SupplicantStatusCode.aidl +++ b/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/SupplicantStatusCode.aidl @@ -40,4 +40,8 @@ enum SupplicantStatusCode { * Interface with the provided name does not exist. */ FAILURE_IFACE_UNKNOWN = 4, + /** + * Operation is not supported by the service. + */ + FAILURE_UNSUPPORTED = 5, } diff --git a/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/UsdMessageInfo.aidl b/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/UsdMessageInfo.aidl new file mode 100644 index 0000000000..0b26d6540c --- /dev/null +++ b/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/UsdMessageInfo.aidl @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 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.system.wifi.mainline_supplicant; + +/** + * Information for sending a USD message. + */ +parcelable UsdMessageInfo { + /** + * Identifier for this device, retrieved from |ServiceDiscoveryInfo|. + */ + int ownId; + + /** + * Identifier for the peer device, retrieved from |ServiceDiscoveryInfo|. + */ + int peerId; + + /** + * MAC address for the peer device. + */ + byte[6] peerMacAddress; + + /** + * Message contents. Note that the maximum message length is + * |UsdCapabilities.maxLocalSsiLengthBytes|. + */ + byte[] message; +} diff --git a/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/UsdServiceProtoType.aidl b/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/UsdServiceProtoType.aidl new file mode 100644 index 0000000000..4e6bbe7392 --- /dev/null +++ b/aidl/mainline_supplicant/android/system/wifi/mainline_supplicant/UsdServiceProtoType.aidl @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2024 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.system.wifi.mainline_supplicant; + +/** + * Service protocols that use USD. + */ +@Backing(type="int") +enum UsdServiceProtoType { + /** + * Unknown service type. + */ + UNKNOWN = 0, + + /** + * Generic service. + */ + GENERIC = 1, + + /** + * CSA (Connectivity Standards Alliance) Matter. + * + * Note: CSA Matter is an open-source, royalty-free standard for smart home technology that + * allows devices to work with any Matter-certified ecosystem. + */ + CSA_MATTER = 2, +} |